Skip to content

feat!: migrate to TurboModules#9080

Merged
mikehardy merged 37 commits into
mainfrom
new-architecture
Jul 6, 2026
Merged

feat!: migrate to TurboModules#9080
mikehardy merged 37 commits into
mainfrom
new-architecture

Conversation

@mikehardy

@mikehardy mikehardy commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Coordinated New Architecture migration: legacy NativeModules → Codegen TurboModules (NativeRNFBTurbo*), unified module resolver, committed generated artifacts, and shared test/validation infrastructure.

Status: All native bridge packages migrated (Phases 0–5). Phase R complete — NativeModules fallback removed; missing TurboModules throw at resolver. EventEmitter cutover deferred to Phase C; async→sync conversion deferred to Phase S.

Infra in this branch: architecture decisions (OKF), gitignored harness overrides, implementation/review gate hardening, Jest TurboModule contract tests, compare:types registration, codegen:verify CI guard, Android emulator cold-boot for reliable Detox runs.

Related #8584

Migration checklist

  • @react-native-firebase/app
  • @react-native-firebase/functions
  • @react-native-firebase/auth
  • @react-native-firebase/firestore
  • @react-native-firebase/database
  • @react-native-firebase/messaging
  • @react-native-firebase/storage
  • @react-native-firebase/crashlytics
  • @react-native-firebase/analytics
  • @react-native-firebase/remote-config
  • @react-native-firebase/app-check
  • @react-native-firebase/perf
  • @react-native-firebase/installations
  • @react-native-firebase/in-app-messaging
  • @react-native-firebase/app-distribution
  • @react-native-firebase/ml
  • @react-native-firebase/phone-number-verification

Test plan

CI / unit validation

  • yarn lint:js / yarn lint:android / yarn lint:ios:check
  • yarn tests:jest — package contract tests + TurboModule parity guards
  • yarn codegen:verify — generated artifacts match committed output
  • yarn compare:types — all registered packages green (19/19)

Area-focused e2e (per migrated package)

  • app — full tier
  • firestore — area-focused (multi-module + pipelines)
  • installations, perf, in-app-messaging, app-distribution, ml — area-focused
  • app-check, remote-config, analytics, crashlytics, storage — area-focused
  • messaging — area-focused (turbo shell; legacy event path preserved per AD-4)
  • database — area-focused (5 specs)
  • auth — area-focused (60-method spec)
  • phone-number-verification — area-focused (Android-only)

Phase R — full harness (3-platform proof run)

  • macOS yarn tests:macos:test-cover — 683 passing / 36 pending / 0 failing
  • iOS yarn tests:ios:test-cover — 823 passing / 85 pending / 0 failing
  • Android yarn tests:android:test-cover — 849 passing / 58 pending / 0 failing
  • Phase R resolver e2e — getReactNativeModule throws for unknown module (all platforms)
  • Android emulator cold boot — Detox launches with -no-snapshot-load (gray-screen fix)

Known deferred (not merge blockers)

  • Messaging foreground onMessage delivery e2e — remains xit; re-enable in Phase C
  • Phase S async→sync conversion — follow-on coordinated API change
  • Phase C EventEmitter cutover — follow-on cleanup

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request initiates the coordinated migration of the React Native Firebase monorepo to the React Native New Architecture using TurboModules. It establishes the foundational infrastructure, including a unified module resolver, committed generated artifacts, and updated type-testing configurations. The changes focus on migrating the core app and functions packages while providing the necessary tooling and documentation to support the subsequent migration of remaining native packages.

Highlights

  • TurboModules Migration: Migrated legacy NativeModules to Codegen TurboModules for @react-native-firebase/app and @react-native-firebase/functions, establishing the foundation for the coordinated New Architecture migration.
  • Modular API Alignment: Updated TypeScript type comparison configurations (compare:types) to ensure modular API parity with the firebase-js-sdk, including new exports for SDK_VERSION and various helper types.
  • Documentation & Workflow: Added comprehensive migration documentation for v26 (namespaced API removal) and updated internal OKF bundles to include new architecture decisions, implementation workflows, and agent command policies.
  • Test Infrastructure: Enhanced Jest setup with TurboModuleRegistry mocks and added a new contract test suite (nativeModuleContract.test.ts) to validate the TurboModule wrapper contract.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the deprecated namespaced JavaScript API across multiple packages (such as analytics, app-check, and app-distribution) to transition to a modular-only architecture for v26. It also introduces the foundational TurboModule migration for the app package under the New Architecture, updating native iOS/Android configurations, JNI codegen, and test harness setups. Feedback on these changes highlights several stability improvements, including preventing a TypeError in initializeAppCheck when options are omitted, ensuring correct context and null-safety when resolving native module constants, adding try-catch protection to app-destroy callbacks, and guarding against potential null pointer exceptions when querying external storage directories in Android.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/app-check/lib/index.ts
Comment thread packages/app/lib/internal/nativeModuleAndroidIos.ts
Comment thread packages/app/lib/internal/registry/app.ts Outdated
@mikehardy mikehardy marked this pull request as ready for review July 3, 2026 06:11
@mikehardy

This comment was marked as resolved.

mikehardy added 24 commits July 3, 2026 07:21
Add TurboModule migration OKF bundle with work queue, implementation
workflow extending change authoring, and package-extensions cross-link.
…n infra

BREAKING CHANGE: App/Core modules native bridge requires New Architecture.

Migrate RNFBAppModule and RNFBUtilsModule to Codegen TurboModules with
unified resolver, lazy Proxy wrapper, and committed generated artifacts.
Includes functions codegenConfig rename (NewArch-AD-7), test harness
overrides, architecture decisions, and validation workflow hardening.
Register @react-native-firebase/app in compare:types and document 25
modular API deltas against firebase-js-sdk. Type SDK_VERSION as string.
BREAKING CHANGE: Firestore native bridge requires New Architecture.
Legacy NativeModules bridge removed; four Codegen TurboModule specs
(NativeRNFBTurboFirestore{,Collection,Document,Transaction}) with
committed generated artifacts, Android/iOS turbo shells, and JS wiring.
Environment.getExternalStoragePublicDirectory can return null when
external storage is unavailable; guard the pictures and movies
directory constants instead of dereferencing getAbsolutePath directly.
Durable NewArch-AD-4 § messaging: evidence table from primary sources,
shell-only Phase 4 scope, and explicit testing gate for event delivery.
Queue rows point to ADR; no duplicated gap-analysis narrative.
Convert the messaging native module to a Codegen TurboModule shell while
keeping the legacy event-emitter path in place per NewArch-AD-4. Method
calls now route through NativeRNFBTurboMessaging (iOS .mm shell, Android
spec-backed shell); event delivery continues over the app-module proxy so
foreground, background, and headless message handling are unchanged.

Add committed codegen artifacts, register messaging in codegen:verify and
the spec-native parity list, and remove the legacy Android module.

BREAKING CHANGE: messaging requires the React Native New Architecture.
Apply google-java-format and clang-format (Google style) to migrated
TurboModule native shells so yarn lint exits 0 repo-wide on the NA branch.
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.78899% with 253 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.77%. Comparing base (76ace9b) to head (ae5976c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9080      +/-   ##
==========================================
+ Coverage   58.72%   59.77%   +1.05%     
==========================================
  Files         333      363      +30     
  Lines       24985    27642    +2657     
  Branches     4149     4155       +6     
==========================================
+ Hits        14671    16520    +1849     
- Misses       9504    10342     +838     
+ Partials      810      780      -30     
Flag Coverage Δ
android-native 43.53% <56.87%> (+0.94%) ⬆️
e2e-ts-android 43.53% <56.87%> (+0.94%) ⬆️
e2e-ts-ios 53.48% <73.74%> (+1.64%) ⬆️
e2e-ts-macos 41.20% <75.00%> (-0.08%) ⬇️
ios-native 53.48% <73.74%> (+1.64%) ⬆️
jest 47.89% <79.52%> (+1.62%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is a big PR 😄! Wonderful to have TurboModules practically complete 🥳 . I like the OKF docs, keep everything in the repo. Although quite a lot to take in 😅. LGTM

@mikehardy mikehardy merged commit 6ff817e into main Jul 6, 2026
22 checks passed
@mikehardy mikehardy deleted the new-architecture branch July 6, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants