Old architecture vs. new architecturePart 1 of 14
Vocabulary
Native modules, specs, and the three layers every native feature is made of
BeginnerVerified on React Native 0.88Updated 6 December 2026
The big idea#
JavaScript can't open the camera, read the keychain or draw a native button by itself. Anything platform-specific lives in native code, and React Native's job is to let JavaScript call it. Before looking at how that works, you need four words: native module, native module system, spec, and the split between interface and implementation.
Concepts#
Native module#
A native module is platform code that JavaScript can call: a camera API, a secure storage API, an encryption library.
Today it's written in Kotlin on Android and Swift on iOS, with a thin Objective-C++ layer on iOS. It can also be written once in C++ and shared by both platforms. Higher-level frameworks such as Expo Modules and Nitro Modules offer friendlier ways to write the same thing, and all of them sit on the same foundation (see JSI).
Native module system#
The native module system is the plumbing that carries a call from JavaScript to native code and back.
There used to be two: the old bridge-based system, which turned every call into JSON, and the new one. Since 0.82 there is only one, Turbo Modules over JSI. The old system's code was then deleted in 0.84 and 0.85.
The spec#
A spec is a TypeScript (or Flow) file that describes a module's API and nothing else. The code generator reads it. The rules are strict:
// NativeCalculator.ts ← the file name must start with "Native"
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
export interface Spec extends TurboModule {
add(a: number, b: number): number; // synchronous
fetchRate(currency: string): Promise<number>; // asynchronous
}
export default TurboModuleRegistry.getEnforcing<Spec>('Calculator');- Native component specs (custom views) must end in
NativeComponent.ts. - Only types the code generator understands are allowed: numbers, strings, booleans, objects, arrays, promises, callbacks, and since 0.88
ArrayBufferfor binary data.
Interface, glue, implementation#
Every native feature is made of three layers:
| Layer | Written by | Example |
|---|---|---|
| Interface | You | NativeCalculator.ts, the spec |
| Glue | Codegen (generated) | NativeCalculatorSpec.java, a C++ JSI binding |
| Implementation | You | CalculatorModule.kt, RCTCalculator.mm |
The three layers of a native module
Layers from top to bottom: Spec (interface) (You write it); Glue (Codegen generates it); Implementation (You write it).
- JavaScript
- Build time
- Native
Myths vs reality#
Myth
With Codegen you don't have to write native code yourself
Reality: Codegen writes the glue, not the logic. If your spec declares add(a, b), Codegen generates an abstract add method, and you implement it. If you forget, the native build fails. That failure is the type safety Codegen is designed to give you.
Myth
There are two native module systems
Reality: that was true until 0.81. Since 0.82 the New Architecture is always on and can't be disabled, so there is only one.
In one sentence
A native module is a spec (you), glue (Codegen) and an implementation (you), and since 0.82 there's only one system connecting them: Turbo Modules over JSI.