Bước 1 — Native Module:
- Chuyển từ RCTBridgeModule (iOS) / ReactContextBaseJavaModule (Android) sang TurboModule spec.
- Viết file spec TypeScript NativeFoo.ts với interface Spec extends TurboModule.
- Chạy bundle exec pod install → Codegen sinh RNFooSpec.h/.mm.
- iOS: implement class kế thừa <RNFooSpec> protocol.
- Android: extends NativeFooSpec abstract class.
Bước 2 — Native Component (custom view):
- iOS: RCTViewManager → RCTComponentViewProtocol + Fabric component descriptor.
- Android: ViewManager → RCTViewManager (Fabric variant) + ViewProps C++ struct.
- Codegen type: "components" cho component spec.
Bước 3 — Update package.json:
"codegenConfig": {
"name": "RNFooSpec",
"type": "all",
"jsSrcsDir": "src"
}Bước 4 — Test compat:
- expo doctor hoặc npx react-native doctor báo issue.
- Build app với RCT_NEW_ARCH_ENABLED=1 (iOS) / newArchEnabled=true (Android gradle.properties).
- Test toàn bộ public API, đặc biệt method sync (vốn async ở bridge).
- Run trên cả Hermes và JSC.
Bước 5 — Document:
- README ghi version RN tối thiểu hỗ trợ.
- CHANGELOG cảnh báo breaking change (nếu API JS có thay đổi).
- Drop legacy support sau 2–3 minor version để clean codebase.
Resources: RN New Arch Working Group có spreadsheet tracking lib status (supported / in-progress / unsupported).
Step 1 — Native Module:
- Switch from RCTBridgeModule (iOS) / ReactContextBaseJavaModule (Android) to a TurboModule spec.
- Write a TypeScript spec NativeFoo.ts with interface Spec extends TurboModule.
- Run bundle exec pod install → Codegen produces RNFooSpec.h/.mm.
- iOS: implement a class conforming to the <RNFooSpec> protocol.
- Android: extend the NativeFooSpec abstract class.
Step 2 — Native Component (custom view):
- iOS: RCTViewManager → RCTComponentViewProtocol + a Fabric component descriptor.
- Android: ViewManager → Fabric-variant RCTViewManager + a ViewProps C++ struct.
- Codegen type: "components" for the component spec.
Step 3 — update package.json:
"codegenConfig": {
"name": "RNFooSpec",
"type": "all",
"jsSrcsDir": "src"
}Step 4 — test compatibility:
- Run expo doctor or npx react-native doctor for diagnostics.
- Build with RCT_NEW_ARCH_ENABLED=1 (iOS) / newArchEnabled=true (Android gradle.properties).
- Test the full public API, especially synchronous methods (previously async via the bridge).
- Test on both Hermes and JSC.
Step 5 — document:
- README states minimum supported RN version.
- CHANGELOG flags breaking changes (if the JS API shifted).
- Drop legacy support after 2–3 minor versions to clean the codebase.
Resources: the RN New Architecture Working Group maintains a spreadsheet tracking library status (supported / in-progress / unsupported).