r/reactnative • • 3d ago

Is NitroUI a React Native properly done?

Expo's Exact is a fully new contract based paradigm. NitroUI though is pure React with some on going efforts to interop with existing Expo/Nitro modules.

I'm seeing crazy demos where NitroUI is faster than Exact and even native?!?

This is very cool. Thoughts?

13 Upvotes

20 comments sorted by

11

u/HoratioWobble 3d ago

I've just looked it up, I'm confused.

Every "selling point" is just describing React Native.

2

u/andreidotcalazans 2d ago

Yup. It's the same RN philosophy but with a new take on the underlying architecture (runs on the main thread) while using static Hermes

1

u/HoratioWobble 2d ago

RN runs across multiple threads, I don't think it's been single thread for a while.

1

u/mrousavy iOS & Android 3h ago

That's not what this means. React Native runs your JS on a separate Thread, NOT the UI Thread. This is where you build your views, which then land in a separate representation of the view hierarchy (the "Shadow Tree"), only to be then scheduled on the UI Thread to render - this involves a thread hop and is the reason why React Native sometimes renders blanks in Lists, or has controlled TextInput glitches.
NitroUI does not do that at all because the JS runs on the UI Thread. That's the difference. How many Threads an app has depends on your native modules (e.g. VisionCamera uses multiple Threads, background processors or crypto modules, etc - that is something else entirely.)

1

u/HoratioWobble 3h ago

Fair enough, that's my misunderstanding then.

6

u/cheesekun 2d ago

Looks like every idiot thinks they have a business idea now

2

u/mrousavy iOS & Android 3h ago

Unfortunately your mouth is faster than your brain. NitroUI is fundamentally different than React Native because it runs the JS (+ React) on the UI Thread, while RN does it on a separate Thread, with a separate state (= Shadow Tree) describing the view hierarchy. This is why React Native sometimes has blank cells in Lists or controlled TextInput glitches, while NitroUI doesn't.
Also we use a different layout engine, an entirely different module system (Nitro), opinionated core packages (components, storage, ...), precompiled core packages (Static Hermes FFI), and our own reconciler implementation.

2

u/AwareWeb2680 7h ago

Not sure what do you mean by describing react native .

  1. React native renders async , Nitro UI renders sync by default
  2. Nitro UI has a different layout engine
  3. There is no concept of shadow tree
  4. The only thing common is the hermes engine .

1

u/mrousavy iOS & Android 3h ago

Yup! Different architecture entirely, but user-facing it's still JSX and React - maybe this confused some people.

1

u/DulsKerty 2d ago

right? half the bullet points just sound like the new architecture with different buzzwords

3

u/Healthy-Duck9316 7h ago

Slightly disagree, the new architecture and nitroUI work fundamentally different at an architecture level, even on the react-reconciler level. RN new arch is using thread safe persistent mode, so it can work on mutating the UI from any thread. NitroUI doesn't need this since all UI operations are just happening on the main thread, so it runs react in mutation mode. That basically means that NitroUI doesn't have to carry an immense architectural overhead that react-native has to carry. react-native needs a "shadow tree" representation which adds an abstraction layer, and this abstraction layer comes with an actual, measurable, performance cost.
Two frameworks working fundamentally different at the arch level don't sound to me like "the same"

1

u/Jonovono 2d ago

How’s it compare to lynx ?

3

u/sylentshooter 2d ago

Uses the same view layout engine as Lynx does by default

1

u/caioedut 2d ago

My mind blows!

1

u/startup_sidequest67 2d ago

I’d be cautious about the “faster than native” claim until the benchmark defines what “native” means and compares the same UI and workload on the same devices. For an app, I’d want release-build results for cold start, frame-time consistency, memory use, and responsiveness under load, not just a demo.

I’m also curious how the interop works with existing Expo modules: which ones run as-is, and which need Nitro-specific adapters? Reproducible benchmarks on a lower-end device would make the comparison much easier to judge.

2

u/mrousavy iOS & Android 3h ago

We didn't do the "faster than native" benchmarks, it was measured by someone in the community where NitroUI was faster at scrolling through a list than their Kotlin Compose app.
Kotlin Compose is "native", and since we don't use Compose under the hood but instead Android Views, we managed to beat "native" here.
Native Android Views on the other hand is not beatable by design, because NitroUI is an abstraction on top of that - so it's by design not possible to beat. Same for RN or Expo. Or Exact for that matter.