Valdi – A cross-platform UI framework that delivers native performance

github.com

520 points by yehiaabdelm 3 days ago


bearjaws - 3 days ago

Working at a company that uses react-native I wish nothing more than for the end of app stores and differing platform languages.

We're heavily considering just having a website next year with a mobile app using webview, and then native code for the native notifications, GPS and healthkit / health connect.

I feel like AI is changing the equation, its nearly better to write your business UI 3 times one for each platform.

pzo - 2 days ago

Looks in concept very similar to React Native. So now we have React Native, Lynx.js (ByteDance/Tiktok) and Valdi all based on React. I think competition is good for devs. But not sure if any of those will create ecosystem and community big enough and fast enough to React Native.

React Native grew a lot this year and a lot of things got or will be improved and copied from Lynx or Valid:

- 3 modes of compilation (AOT, JIT) from Valdi will be in static hermes (RN) in coming months.

- native binding generation -> RN already have such official generator and also nitro/nitrogen, they also working on Node-API

- executing animation and JS code in different thread (Lynx.js) -> worklet library in RN from swmansion

- tailwindcss support (Lynx) -> uniwind in RN land.

I think Lynx.js maybe have better shot at React Native since they want to support other frameworks instead of only React.

joenot443 - 3 days ago

I was at Snap during this project’s early days (Screenshop!) and spent a bit of time debugging some stuff directly with Simon. He’s a wonderful engineer and I’m thrilled to see this project out in the open. Congratulations Snap team! Well deserved.

mholm - 3 days ago

I’m not sure I trust snap of all companies to make a good cross platform framework after how terrible their android app has been.

GaryBluto - 2 days ago

I cannot possibly think of something I would want to use less. A Snapchat-developed UI framework where communication is done via Discord sounds like something carefully designed to repulse me.

digianarchist - 3 days ago

> Valdi is a cross-platform UI framework that delivers native performance without sacrificing developer velocity. Write your UI once in declarative TypeScript, and it compiles directly to native views on iOS, Android, and macOS—no web views, no JavaScript bridges.

maxloh - 3 days ago

If you are curious how components' state is handled, they employed the React class components method:

  // Import the StatefulComponent
  import { StatefulComponent } from 'valdi_core/src/Component';
  
  // ViewModel + State interfaces for component
  export interface TimerViewModel { loop: number }
  interface TimerState { elapsed: number }
  
  // Component class
  export class Timer extends StatefulComponent<TimerViewModel, TimerState> {
    // Initialize the state
    state = { elapsed: 0 };
    // When creating the component, start a periodic logic
    private interval?: number;
  
    // Initialize the setInterval that will update state once a second incrementing
    // the `elapsed` state value.
    onCreate() {
      this.interval = setInterval(() => {
        // Increment the state to trigger a re-render periodically
        const elapsed = this.state.elapsed;
        const loop = this.viewModel.loop;
        this.setState({ elapsed: (elapsed + 1) % loop });
      }, 1000);
    }
  
    // When component is removed, make sure to cleanup interval logic
    onDestroy() {
      if (this.interval) clearInterval(this.interval);
    }
  
    // Render visuals will depend both on the state and the view model
    onRender() {
      <view padding={30} backgroundColor='lightblue'>
        <label value={`Time Elapsed: ${this.state.elapsed} seconds`} />;
        <label value={`Time Looping every: ${this.viewModel.loop} seconds`} />;
      </view>;
    }
  }
https://github.com/Snapchat/Valdi/blob/main/docs/docs/core-s...
sheepscreek - 2 days ago

I looked at the source code (as an amateur application developer) and boy, is it over-engineered and complex! Then I remember having built a complex Cordova app more than a decade ago, where I had to make C++, JNI and Javascript interop all play nice and this project feels a lot like that. Lots of moving parts. I suppose this is just the way things are when you are targetting such different ecosystems as Android and iOS _natively_, at the lowest level.

As a solo-dev, I realize well that this project isn't for me. This could be a great tool for experienced folks who know what they are doing. I will stick to Tauri and React Native, it does 80% of what I care about with 20% of the effort. Or until someone builds a nice wrapper around this to make it easy to use (and also add targets for x86_64/aarch64 builds).

JaggerJo - 2 days ago

Just write 2 native UIs in the 2 platform native languages and share a common core written in any language that offers a C like FFI.

How hard could it be?

a2800276 - 2 days ago

Unfortunately no Linux, Windows or even HTML targets?

IgorPartola - 3 days ago

This looks promising. I would love to see more examples of what this can do along with screenshots. As is, there is a single Hello World and the components library is “coming soon”. But if it can deliver what it promises that would be pretty cool. React Native is I think the main popular framework in this space.

potato-peeler - 2 days ago

What does using native view mean? Do they invoke native ui controls instead of drawing their own? Seems similar to boden - https://www.boden.io/

vmsp - a day ago

Snapchat also maintains Djinni, used to generate type-safe bindings for C++ code. With Valdi, it seems like they chose to go another route.

https://github.com/Snapchat/djinni

topherPedersen - 3 days ago

This is so cool! I'm a React-Native developer, and I'm glad to see more options like this coming into existence.

michaell22 - a day ago

I built an app in capacitor react which usea webview. It's called Snap Tap Relax its on android and app store. I think it is good for webview. Mind letting me know what you think? Is it slow or good? Notice that it's not native?

yieldcrv - 3 days ago

So this is like all those other frameworks that compile to native components, except this one is natively Typescript?

I’ll take it

easeout - 2 days ago

Native performance doesn't earn that much user goodwill without native layout and behavior. You can't make a single design for many platforms and please everyone who chose each platform for what it is. Unless perhaps you are Snap and having a _unique_ UI is part of the appeal for your young-leaning audience.

simianwords - 2 days ago

I often wonder how the economics are justified in making in house frameworks. What is it about Snapchat that requires a new framework but not other apps?

VerifiedReports - 2 days ago

"A C++, Objective-C or Kotlin object or function exposed to TypeScript is called a Native Reference within the runtime. A TypeScript function exposed to C++, Objective-C or Kotlin is called a JS Value Reference."

Concerning that there's no mention of Swift there. Or SwiftUI.

xngbuilds - 2 days ago

Is there an AI agent that excels that translating UI codes between SwiftUI, Jetpack Compose and web?

instagary - 3 days ago

I wish the native iOS part was written in Swift rather than Objective-C like RN.

isaachinman - 2 days ago

I've worked and researched heavily in this field. If you want to write one codebase that hits all platforms with _actual native performance_ your only option at the moment is RN/Expo.

kbody - a day ago

I imagine unpopular opinion, but I don't like the React design or syntax, its adoption was one of the reasons it made me move away from front-end. I'd rather Valdi and other efforts have a different opinionated design and syntax, less over-engineering and more fun.

sans_souse - 3 days ago

So now I can finally implement the most god-awful, ugly, cumbersome and unintuitive GUI methodology ever to face a large population of users into my own apps? This abomination that started the whole user-experience decline by making this kind of yuck the gold standard for apps today is finally open source?

Color me yellow.

topherPedersen - 3 days ago

Rename it Snapp

- 2 days ago
[deleted]
FridgeSeal - 2 days ago

Ah yes, Snapchat, an app famous for its high performance, efficient apps, which definitely never made your phone hot and drained your battery.

Seriously, if there’s an app that sticks in my head for being noticeably laggy, you couldn’t pick a better example than Snapchat.

toiladoong - a day ago

[dead]

hulitu - 2 days ago

> Valdi – A cross-platform UI framework

I presume this is a Text UI. How does it compares with ncurses and termcap ? /s

sreekanth850 - 3 days ago

Not related to this, but abandoning Key DB was the worst thing they could do.

skeptrune - 3 days ago

Its hard to imagine not going fully native in the modern day with coding agents. Most of the code can just be clanked out.

maxdo - 3 days ago

Not to troll , Do you need such shims in the era of llm ?