CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

react/react-native

Scanned commit b7c0e4986a dated 2026-09-22 — last upstream commit. Generated by codevetter 1.12.0 on 2026-09-22.

github.com/react/react-native ↗ · 3998 files · 26.0 MB · scan capped

Learn once, write anywhere: Create native apps for Android, iOS, and more using React Getting Started · Learn the Basics · Showcase · Contribute · Community · Support React Native React Native lets you build native apps using React.

Deep analysis by swe-2 via the devin CLI on 2026-09-22 (runtime not recorded) — every claim below links to its cited source files.

Overview

React Native is a Yarn-workspaces monorepo that produces the `react-native` npm package plus ~25 sibling packages (@react-native/codegen, dev-middleware, community-cli-plugin, metro-config, gradle-plugin, debugger-frontend, etc.). It implements a React renderer for iOS and Android: Flow-typed JavaScript in packages/react-native (legacy `Libraries/` being migrated to `src/private/`), a shared C++ core in ReactCommon (Fabric renderer, TurboModules, JSI, Hermes glue, Yoga layout, jsinspector-modern), and platform runtimes in ReactAndroid (Kotlin/Java) and React/ReactApple (Objective-C++/Swift). Its distinctive machinery is a codegen pipeline that generates type-safe native bindings from `Native*.js`/`*NativeComponent.js` specs, a feature-flag system generated across JS/Java/C++, and Fantom, a headless integration test runner that executes JS on Hermes against real C++ Fabric with a mock host platform.

System map

Yarn v1 workspaces monorepo rooted at package.json (@react-native/monorepo). The flagship artifact is packages/react-native, which ships the JS public API (index.js lazy getters), the C++ core (ReactCommon), the Android runtime (ReactAndroid, Gradle), and the Apple runtime (React + ReactApple, CocoaPods podspecs + SwiftPM Package.swift). Tooling packages around it provide the dev server CLI (@react-native/community-cli-plugin), CDP inspector proxy (@react-native/dev-middleware), Metro defaults (@react-native/metro-config), codegen (@react-native/codegen), and the Gradle plugin. Repo-local test surfaces live in packages/rn-tester, private/helloworld, and private/react-native-fantom. CI is orchestrated by .github/workflows/test-all.yml.

All 13 system map claims →

Feature catalog

User-facing surface = the react-native package's JS API (components + imperative APIs + hooks), the `react-native` CLI commands (start/bundle/codegen/spm via community-cli-plugin), the dev-middleware debugging endpoints, Web-platform APIs (observers, performance), and the published support packages (jest-preset, eslint configs, babel preset, metro-config). Deprecated APIs are still exported behind warnOnce() warnings; several experimental APIs ship under unstable_/experimental_ prefixes.

All 13 feature catalog claims →

Data flow

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.

Behavior traces

Three flows were traced end-to-end: (A) JS environment init -> app registration -> first render; (B) `react-native start` dev-server boot from the bin shim through Metro.runServer; (C) a TurboModule/native call plus codegen generation. Ordered function calls are named in each claim.

Testing signals

Two JS test systems: Jest 29 unit tests in __tests__/*-test.js (custom preprocessor + haste resolver that strips `exports`, ios/android platforms, fake timers globally) and Fantom *-itest.js integration tests that run JS on Hermes against the real C++ Fabric/mounting stack with a mock host platform — Fantom files must live under packages/react-native. Native testing: Gradle test task for ReactAndroid, scripts/objc-test.sh + RNTesterUnitTests/RCTTest for iOS. CI in test-all.yml gates on lint, test_js, build_js_types, Fantom (with two retry rounds), Android/iOS builds, helloworld e2e, RNTester e2e and Maestro cloud runs.

Risk map

Dominant risk is the long-running architecture migration: legacy bridge (ReactNativeHost/ReactInstanceManager, BatchedBridge/MessageQueue, runtime codegenNativeComponent fallback) coexists with bridgeless ReactHost + TurboModule proxy, so behavior diverges by mode. Generated-code drift is a second axis — feature flags, TS types, codegen output, and three committed API snapshots all fail CI if not regenerated. The dev-middleware WebSocket inspector endpoints are a security-sensitive surface when the dev server is exposed beyond localhost. Several foot-guns exist for tooling: preinstall mutates yarn.lock, Jest resolution diverges from Metro, and cli.js silently tolerates a missing community CLI.

Extension points

Extension happens at well-defined seams: JS spec files (Native*.js / *NativeComponent.js) + codegenConfig libraries in package.json feed codegen; TurboModuleRegistry and codegenNativeComponent/requireNativeComponent are the runtime registration points; AppRegistry.registerComponent(+setWrapperComponentProvider/setRootViewStyleProvider) registers root surfaces; community-cli-plugin exports composable Command objects (with unstable_createBundleCommandParser for custom parsers); createDevMiddleware exposes unstable_* hooks; metro-config exposes getDefaultConfig/mergeConfig/setFrameworkDefaults; the Gradle ReactExtension DSL and iOS RCTReactNativeFactoryDelegate/RCTDependencyProvider are the native wiring points; the feature-flag config and Fantom pragmas are repo-internal extension points.

Contributor handoff

Start with AGENTS.md — it is the canonical contributor doc (repo layout, commands, gotchas). JS is Flow; expect paired .js/.js.flow files and code split between Libraries/ (legacy) and src/private/ (target). Verify with yarn test / yarn fantom / yarn lint / yarn flow-check; build @react-native/codegen once before Metro works. Never hand-edit generated artifacts — regenerate via yarn featureflags / yarn build-types / codegen and keep index.js in sync with index.js.flow. Respect the committed API snapshots (ReactNativeApi.d.ts, ReactAndroid.api, scripts/cxx-api) and the yarn.lock churn from the preinstall hook.

Languages

LanguageFilesShare of source
JavaScript239142%
C142525%
Kotlin95117%
C++65712%
Markdown287docs/config
TypeScript1312%
YAML102docs/config
JSON83docs/config

Start reading here

Probable source entrypoint: packages/ — inferred from the directory tree and manifest, not the upstream docs.

Source roots

packages/ (3093 files)

Source layout — packages/

PathFiles
packages/asset-utils/7
packages/assets-registry/7
packages/babel-plugin-codegen/7
packages/community-cli-plugin/32
packages/debugger-frontend/4
packages/debugger-shell/26
packages/dev-middleware/45
packages/eslint-config-react-native/4

Repository structure

Top-level pathFiles
packages/3093
scripts/511
private/205
.github/92
flow-typed/48
.expo-code-review/9
__docs__/3
gradle/2

Docs found: AGENTS.mdCONTRIBUTING.mdREADME.md

Package

Gemfile — , 0 declared dependencies.

CI & config entrypoints

Structural health signals

Average score 5.9/10 across 96 analyzed source files; 70 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history