Old architecture vs. new architecturePart 5 of 14
The event loop
How React Native decides what runs next, and when the screen updates
IntermediateVerified on React Native 0.88Updated 6 December 2026
Read first: Bridgeless mode
The big idea#
An event loop is the rule a thread follows to decide what runs next. The old architecture didn't have one: the JS thread worked through bridge batches in whatever order they arrived. The new architecture uses the model browsers use, implemented in a C++ class called RuntimeScheduler, and it comes with one firm guarantee: nothing is painted while a task is still running.
Concepts#
The web model#
- Run one task, such as a touch handler, a timer callback or a native module result.
- Run every microtask: resolved Promise callbacks and
awaitcontinuations, including new ones added while the queue drains. - Update the rendering, so the screen shows the result.
- Repeat.
The event loop inside RuntimeScheduler
Boxes: Native events; Timers; Native callbacks; React work; Task queue (Sorted by priority); Run one task (JS thread, Hermes); Drain microtasks (Promises, await); Update rendering (Fabric mounts views). Arrows: Native events to Task queue; Timers to Task queue; Native callbacks to Task queue; React work to Task queue; Task queue to Run one task; Run one task to Drain microtasks; Drain microtasks to Update rendering; Update rendering to Task queue (next turn).
- Other
- C++
- JavaScript
- Native
Before: no defined loop#
Under the bridge, a task was whatever messages a bridge batch happened to contain, often several unrelated things. Promises were a JS polyfill scheduled with setImmediate, so they ran at the end of each batch rather than after each task. And there was no render step at all: React's changes went out at the end of a batch, were laid out later on the shadow thread, and were painted later still.
This showed up in three ways. Layout jumped, because measure() was asynchronous: a component rendered in the wrong place, was measured a frame later, then moved. Batching was inconsistent, so setState inside a .then or a setTimeout caused its own render. And nothing had priority, so a tap could wait behind a large list update.
After: what it fixes#
The first change is synchronous layout. Fabric calculates layout in C++ during the commit, so useLayoutEffect can measure and correct positions before anything is painted:
function Tooltip({ targetRef, children }) {
const ref = useRef<View>(null);
const [top, setTop] = useState(0);
useLayoutEffect(() => {
const target = targetRef.current!.getBoundingClientRect(); // synchronous
const self = ref.current!.getBoundingClientRect(); // synchronous
setTop(target.top - self.height); // re-render in the SAME task
}, []);
return <View ref={ref} style={{ position: 'absolute', top }}>{children}</View>;
}Batching becomes automatic: every setState in the same task turns into one render, including those inside Promises, timers and native callbacks. And work finally has priorities. A tap is high priority, work wrapped in startTransition is low priority and can be interrupted, and Suspense works fully.
The event loop, before and after
| Before | After | |
|---|---|---|
| Unit of work | A bridge batch | One task, chosen by priority |
| Promises | JS polyfill, end of batch | Native Hermes microtasks, after each task |
| Rendering | Async across three threads | A defined step; nothing painted mid-task |
| Reading layout | Async measure(callback) | Synchronous in useLayoutEffect |
| Batching | Only in event handlers | Everywhere |
| Priorities | None | Discrete events, transitions, Suspense |
In practice#
- Microtasks can block painting. A long chain of
awaits, or heavy work in a.then, all runs before the render step. To let the screen update, end the task withsetTimeout(..., 0)orrequestAnimationFrame. awaitdoesn't mean "next frame". Code after an already-resolved Promise runs before paint, in the same turn.- Reanimated worklets aren't affected, because they run on the UI thread in their own runtime.
- If you write native modules, never touch the
jsi::Runtimefrom a background thread. Hand results back throughCallInvoker, which schedules a task. Resolving a Promise from native creates a task, and the JS code afterawaitruns as a microtask inside it. - Since 0.88, event dispatching also follows the web: W3C
EventTargetwith capture and bubble phases.
In one sentence
Bridgeless replaced bridge batches with a real event loop (one task, then its microtasks, then a render), and that is what makes synchronous layout in useLayoutEffect, automatic batching and priorities possible.