Course contentsShow
← React Native
Lesson 17 of 1,5551. The React Native ArchitectureFree lesson

Committing Changes to the UI Manager

You will be able to describe the propagation flow from React state change to UI Manager native view updates.

In this lesson, you will learn how the "Shadow Tree" finally bridges the gap to the physical screen by committing updates to the UI Manager.

From Calculations to Pixels

In our previous lesson, we learned that the Shadow Tree exists in a background thread to calculate the layout (using the Yoga engine). However, those calculated coordinates and styles are just data; they aren’t yet visible to the user. To make them real, the Shadow Tree must "commit" its state to the UI Manager.

The UI Manager acts as the bridge between your abstract React components and the platform-specific views (like UIView on iOS or android.view.View on Android).

The Propagation Flow

Think of this process like an architect handing final blueprints to a construction crew:

  1. State Change: You update your React state (e.g., setCount(1)).
  2. Reconciliation: React determines which UI components need to change.
  3. Shadow Tree Update: The Shadow Tree calculates the new layout nodes.
  4. The Commit: The Shadow Tree sends a serialized list of instructions—the "Mutation Instructions"—to the UI Manager.
  5. Native Execution: The UI Manager receives these instructions and commands the native platform to physically move, resize, or create elements on the screen.

If you change the color of a button, the process looks roughly like this:

// React state change
setButtonColor('blue');

// Behind the scenes, the Shadow Tree sends a mutation to the UI Manager:
// UI_MANAGER.updateView(tag, 'backgroundColor', 'blue');

Why "Committing" Matters

The commit is the final "checkpoint." By grouping these updates, React Native ensures that the UI doesn't flicker or attempt to render a partially calculated layout. The UI Manager processes these committed changes as a cohesive set of instructions, ensuring the native views are updated in sync with your logic. This step ensures that what the Shadow Tree calculated is exactly what the user sees, effectively "finalizing" the transition from JavaScript objects to native pixels.

Key Takeaway: The "Commit" is the critical hand-off where the Shadow Tree sends final layout instructions to the UI Manager, triggering the actual native view updates that the user sees on their device.