# Data flow — react/react-native

> Canonical page: https://codevetter.com/unpack/react-native/data-flow

# Data flow — react/react-native

Scanned commit b7c0e4986a0242cdd47afd002f3e712e80914c3c (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

End-to-end: Metro prepends react-native/setup-env to every bundle; setUpDefaultReactNativeEnvironment installs globals then requires AppRegistry; the native side calls AppRegistry.runApplication which resolves the registered runnable and renders through RendererProxy into ReactFabric; Fabric commits to the C++ shadow tree (ReactCommon/react/renderer) and mounts to platform views. Native capabilities are reached through TurboModuleRegistry (__turboModuleProxy with BatchedBridge fallback); native-to-JS calls go through BatchedBridge callFunctionReturnFlushedQueue and DeviceEventEmitter. Native interfaces are declared as JS specs that codegen turns into C++/ObjC++/Java at build time. Feature flags are authored once and generated into JS/Java/C++ accessors.
- Metro serializer getModulesRunBeforeMainModule injects 'react-native/setup-env' before the app entry on every bundle; InitializeCore.js is kept as a deprecated alias that simply requires ../../src/setup-env so it stays in the module graph. — [packages/metro-config/src/index.flow.js#L61-66](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/metro-config/src/index.flow.js#L61-L66) [packages/react-native/Libraries/Core/InitializeCore.js#L25-37](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/Core/InitializeCore.js#L25-L37) [packages/react-native/src/setup-env.js#L22](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/src/setup-env.js#L22)
- setUpDefaultReactNativeEnvironment runs a fixed require order — setUpGlobals, setUpDOM, setUpPerformance, polyfillPromise, setUpTimers, [DEV] setUpReactDevTools, setUpErrorHandling, setUpRegeneratorRuntime, setUpXHR, setUpAlert, setUpNavigator, setUpBatchedBridge, setUpSegmentFetcher, [DEV] checkNativeVersion/setUpDeveloperTools/LogBox.install — then requires AppRegistry and conditionally installs the three observers. A module-level `initialized` flag makes it idempotent. — [packages/react-native/src/private/setup/setUpDefaultReactNativeEnvironment.js#L11-62](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/src/private/setup/setUpDefaultReactNativeEnvironment.js#L11-L62)
- App launch data flow: JS calls AppRegistry.registerComponent(appKey, provider) which stores a runnable in the `runnables` map; native invokes runApplication(appKey, appParameters) over the bridge; the runnable calls renderApplication which wraps RootComponent in AppContainer (plus optional React.unstable_Activity wrapper) and calls Renderer.renderElement with createRootTag(rootTag). — [packages/react-native/Libraries/ReactNative/AppRegistryImpl.js#L92-120](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/AppRegistryImpl.js#L92-L120) [packages/react-native/Libraries/ReactNative/AppRegistryImpl.js#L197](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/AppRegistryImpl.js#L197) [packages/react-native/Libraries/ReactNative/renderApplication.js#L39-92](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/renderApplication.js#L39-L92)
- RendererProxy re-exports RendererImplementation, which resolves to Libraries/Renderer/implementations/ReactFabric-{dev,prod,profiling}.js; the proxy indirection exists so bundles can swap the Fabric renderer variant (profiling vs production) at runtime. — [packages/react-native/Libraries/ReactNative/RendererProxy.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/RendererProxy.js) [packages/react-native/Libraries/ReactNative/RendererImplementation.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/RendererImplementation.js) [packages/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js)
- TurboModule resolution: TurboModuleRegistry.get/getEnforcing first calls global.__turboModuleProxy(name); on miss it falls back to NativeModules[name] (the BatchedBridge-generated module object); getEnforcing throws an invariant naming the module when neither yields a result. — [packages/react-native/Libraries/TurboModule/TurboModuleRegistry.js#L17-47](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.js#L17-L47)
- Legacy-bridge module calls: NativeModules.genModule builds each method via genMethod (typed 'async'|'promise'|'sync' from the ModuleConfig tuple [name, constants, methods, promiseMethodIDs, syncMethodIDs]) which enqueues onto BatchedBridge/MessageQueue.enqueueNativeCall; RCT/RK prefixes must already be stripped natively (invariant). — [packages/react-native/Libraries/BatchedBridge/NativeModules.js#L18-80](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/BatchedBridge/NativeModules.js#L18-L80) [packages/react-native/Libraries/BatchedBridge/MessageQueue.js#L243](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/BatchedBridge/MessageQueue.js#L243) [packages/react-native/Libraries/BatchedBridge/MessageQueue.js#L402](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/BatchedBridge/MessageQueue.js#L402)
- Native -> JS direction: registerCallableModule exposes JS modules to native through BatchedBridge (AppRegistry itself is registered this way at module load, alongside global.RN$AppRegistry); RCTDeviceEventEmitter/NativeAppEventEmitter deliver native events into JS. — [packages/react-native/Libraries/ReactNative/AppRegistry.js#L15-27](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/AppRegistry.js#L15-L27) [packages/react-native/Libraries/Core/registerCallableModule.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/Core/registerCallableModule.js) [packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js)
- Codegen flow: `Native*.js` and `*NativeComponent.js` spec files -> @react-native/codegen parsers (flow/typescript) -> CodegenSchema -> RNCodegen.generate -> LIBRARY_GENERATORS buckets (componentsIOS, componentsAndroid, modulesIOS, modulesAndroid, modulesCxx, descriptors, events, props, states, shadow-nodes, tests) -> writeMapToFiles or checkFilesForChanges (verify mode when test:true). — [packages/react-native-codegen/src/generators/RNCodegen.js#L125-188](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native-codegen/src/generators/RNCodegen.js#L125-L188) [packages/react-native-codegen/src/generators/RNCodegen.js#L196-238](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native-codegen/src/generators/RNCodegen.js#L196-L238) [packages/react-native-codegen/src/parsers/parser.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native-codegen/src/parsers/parser.js) [packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js)
- Codegen is invoked three ways: `react-native codegen` CLI -> scripts/codegen/generate-artifacts-executor.execute(path, platform, outputPath, source); Android Gradle via GenerateCodegenSchemaTask + GenerateCodegenArtifactsTask in the react-native-gradle-plugin; iOS via scripts/generate-codegen-artifacts.js inside the pod build phases. — [packages/community-cli-plugin/src/commands/codegen.js#L44-60](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/community-cli-plugin/src/commands/codegen.js#L44-L60) [packages/react-native/scripts/codegen/generate-artifacts-executor/index.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/scripts/codegen/generate-artifacts-executor/index.js) [packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt) [packages/react-native/scripts/generate-codegen-artifacts.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/scripts/generate-codegen-artifacts.js)
- Feature flags: ReactNativeFeatureFlags.config.js is the single source of truth (common/jsOnly scopes, defaultValue, metadata.purpose, expectedReleaseValue, ossReleaseStage); `yarn featureflags` regenerates the JS (src/private/featureflags/ReactNativeFeatureFlags.js), Java and C++ accessors, which gate behavior like the observers at env setup. — [packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js#L15-58](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js#L15-L58) [packages/react-native/scripts/featureflags/index.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/scripts/featureflags/index.js) [packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js) [packages/react-native/src/private/setup/setUpDefaultReactNativeEnvironment.js#L45-62](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/src/private/setup/setUpDefaultReactNativeEnvironment.js#L45-L62)
- Type pipeline: Flow-typed JS sources -> `yarn build-types` (scripts/js-api using flow-api-translator) -> per-module .d.ts in types_generated/ (generated at build time, referenced by the exports 'types' condition) plus the committed whole-API snapshot ReactNativeApi.d.ts; `yarn test-generated-typescript` type-checks the result against __typetests__. — [package.json#L11](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/package.json#L11) [scripts/js-api/config.js#L30](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/scripts/js-api/config.js#L30) [packages/react-native/package.json#L30-35](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/package.json#L30-L35) [packages/react-native/ReactNativeApi.d.ts](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/ReactNativeApi.d.ts) [package.json#L44-45](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/package.json#L44-L45)
- UI commit path: ReactFabric renderElement -> C++ shadow tree under ReactCommon/react/renderer (uimanager/scheduler/mounting/runtimescheduler) -> platform mount: Android FabricUIManager (com.facebook.react.fabric) and iOS RCTComponentViewFactory/RCTMountingManager; the JS FabricUIManager.js module is the JS-side handle. (inferred) — [packages/react-native/Libraries/ReactNative/FabricUIManager.js](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/Libraries/ReactNative/FabricUIManager.js) [packages/react-native/ReactCommon/react/renderer](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/ReactCommon/react/renderer) [packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt#L56-57](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt#L56-L57) [__docs__/README.md#L45-53](https://github.com/react/react-native/blob/b7c0e4986a0242cdd47afd002f3e712e80914c3c/__docs__/README.md#L45-L53)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
