Old architecture vs. new architecturePart 12 of 14

Fabric

A shared C++ renderer with immutable shadow trees

AdvancedVerified on React Native 0.88Updated 6 December 2026

The big idea#

React is platform-independent: it decides what the UI should be. A renderer makes it real. react-dom produces HTML elements, and Fabric produces native views. React Native's JS renderer calls nativeFabricUIManager.createNode(...), appendChild(...) and completeRoot(...), which are JSI functions installed by Fabric's C++ core. It's the same pattern as document.createElement, with C++ on the other side.

Concepts#

Paper vs. Fabric#

Paper (old)Fabric
Talking to nativeUIManager commands as JSON over the bridgeDirect JSI calls
Core logicWritten twice, in Java and Objective-CShared C++, thin mounting layer per platform
LayoutShadow thread, always asyncIn C++ during commit; readable synchronously
TreeMutableImmutable shadow nodes
React featuresNo concurrent renderingConcurrent features, Suspense, transitions

Host vs. composite components#

  • Composite components are the ones you write (App, ProfileCard). They exist only in JS.
  • Host components map to real native views: View, Text, Image, ScrollView, TextInput, and custom native components.

Only host components get shadow nodes.

Three trees#

One screen in three trees

React elements (JS)
Shadow tree (C++)
Host views (native)
App (composite)
View (red bg)
View (layout only)
Text
No node
ViewShadowNode
ViewShadowNode
ParagraphShadowNode
No view
Native view
Flattened away
Text view

3 columns, rows aligned by position. React elements (JS): App (composite), View (red bg), View (layout only), Text. Shadow tree (C++): No node, ViewShadowNode, ViewShadowNode, ParagraphShadowNode. Host views (native): No view, Native view, Flattened away, Text view.

4 steps

Composites never reach C++, and layout-only views never reach the screen.
  • JavaScript
  • Nothing here
  • C++
  • Native

Inside a shadow node#

  • Props: the parsed C++ version of the component's props.
  • Layout metrics: position and size calculated by Yoga.
  • State: data the native side owns, such as an image's loaded size.
  • Event emitter: how the node sends events back to JS.

Shadow nodes are immutable. An update clones the changed node and its ancestors and shares every unchanged subtree, which has three benefits:

  • Thread safety: an unchanging tree can be read from any thread without locks.
  • Multiple versions: React can prepare a new tree (for example in a startTransition) while the current one stays on screen, then switch atomically.
  • Cheap updates: only the changed path is copied.

View flattening#

A View that only affects layout (no background, border, events or ref) is removed from the host tree, and its position is folded into its children. Fewer native views means faster mounting and less memory. Set collapsable={false} when native code needs a real view to exist.

Text#

Text is measured during layout by the platform's text system (through Fabric's TextLayoutManager), not by Yoga. That's why text properties such as textAlign can behave differently from margins in right-to-left layouts.

Building a native component#

Spec (must end in NativeComponent.ts):

TypeScript
import type { ViewProps, CodegenTypes } from 'react-native';
import { codegenNativeComponent } from 'react-native';

type RegionEvent = { lat: CodegenTypes.Double; lng: CodegenTypes.Double };

interface NativeProps extends ViewProps {
  zoom?: CodegenTypes.WithDefault<CodegenTypes.Float, 10>;
  onRegionChange?: CodegenTypes.DirectEventHandler<RegionEvent>;
}

export default codegenNativeComponent<NativeProps>('MyMapView');

DirectEventHandler events go only to this component; BubblingEventHandler events travel up through parents. Since 0.88 events use the W3C EventTarget model with real capture and bubble phases. Imperative methods are declared with codegenNativeCommands.

Android: a view manager implementing the generated interface:

Kotlin
class MyMapViewManager : SimpleViewManager<MyMapView>(),
                         MyMapViewManagerInterface<MyMapView> {
  private val delegate = MyMapViewManagerDelegate(this)
  override fun getDelegate() = delegate
  override fun getName() = "MyMapView"
  override fun createViewInstance(ctx: ThemedReactContext) = MyMapView(ctx)

  @ReactProp(name = "zoom")
  override fun setZoom(view: MyMapView, value: Float) { view.zoom = value }
}

iOS: a component view:

Objective-CSimplified
@interface RCTMyMapView : RCTViewComponentView @end

@implementation RCTMyMapView { MKMapView *_map; }

+ (ComponentDescriptorProvider)componentDescriptorProvider {
  return concreteComponentDescriptorProvider<MyMapViewComponentDescriptor>();
}

- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
  const auto &p = *std::static_pointer_cast<MyMapViewProps const>(props);
  // apply p.zoom to _map
  [super updateProps:props oldProps:oldProps];
}
@end

updateProps receives the generated C++ props struct. Events are sent by casting _eventEmitter to the generated MyMapViewEventEmitter. iOS recycles component views, so reset per-instance state in prepareForRecycle.

Myths vs reality#

Myth

<View> is a composite component

Reality: View is a host component. Composites are the components you write.

Myth

Fabric exposes its functions to JS through ref functions

Reality: the JS renderer calls Fabric through JSI functions. Separately, since 0.82 a ref to a host component is a DOM-like node with APIs such as getBoundingClientRect() and parentNode.

Myth

The Fabric renderer draws with SurfaceView on Android

Reality: Fabric mounts ordinary platform views (ReactViewGroup, UIView subclasses). SurfaceView is for video and GL content.

In practice#

Recognizing legacy components in libraries:

Legacy (Paper)Fabric
JSrequireNativeComponent('X')codegenNativeComponent in …NativeComponent.ts
AndroidView manager without generated …ManagerInterface / delegateImplements the generated interface
iOSRCTViewManager with RCT_EXPORT_VIEW_PROPERTYRCTViewComponentView with updateProps

Legacy components still render through an interop layer, but lose synchronous layout, typed props and recycling.

In one sentence

Fabric is React Native's renderer: a shared C++ core that React calls through JSI, turning host components into immutable shadow nodes, laying them out in C++, flattening layout-only views and mounting real platform views on the UI thread, with custom components following the same spec → Codegen → implementation pattern as modules.