Skip to content

fix(ios): wire prebuilt React-Core and allow non-modular React imports for use_frameworks! (RN 0.84+) - #9129

Open
aravi365 wants to merge 1 commit into
invertase:mainfrom
aravi365:fix/rncore-framework-module-podspecs
Open

fix(ios): wire prebuilt React-Core and allow non-modular React imports for use_frameworks! (RN 0.84+)#9129
aravi365 wants to merge 1 commit into
invertase:mainfrom
aravi365:fix/rncore-framework-module-podspecs

Conversation

@aravi365

@aravi365 aravi365 commented Jul 28, 2026

Copy link
Copy Markdown

Description

React Native 0.83+ ships a prebuilt React-Core and enables it by default on 0.84+ (RCT_USE_PREBUILT_RNCORE=1). This breaks react-native-firebase iOS builds in two ways:

  1. Header resolution — the legacy <React/...> imports in RNFB's Objective-C sources (RCTConvert.h, RCTBridgeModule.h, RCTEventEmitter.h, …) need the prebuilt React-Core wired via React Native's add_rncore_dependency helper.

  2. Framework module validation — when a consumer builds with use_frameworks! (Expo's default, and required by the firebase-ios-sdk), each RNFB pod is compiled as a framework module. Clang then rejects the non-modular <React/...> includes with:

    error: 'React/RCTConvert.h' must be imported from module 'React' before it is required
    [-Werror,-Wnon-modular-include-in-framework-module]
    

Both are fixed here across all 16 package podspecs:

  • Call add_rncore_dependency(s), guarded with if defined?(...) so older react-native versions are unaffected.
  • Set CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES, merged into any existing pod_target_xcconfig so per-package settings (e.g. generated TurboModule header search paths in analytics/auth/firestore/storage/etc.) are preserved rather than overwritten.

Related

Effect for consumers

Removes the need for the common workarounds:

  • ENV['RCT_USE_PREBUILT_RNCORE'] = '0' (forces React-Core to rebuild from source — slow clean builds)
  • expo-build-properties forceStaticLinking listing every RNFB package

Test plan

  • pod install with use_frameworks! :linkage => :static + $RNFirebaseAsStaticFramework = true on RN 0.84.x, default RCT_USE_PREBUILT_RNCORE (prebuilt), New Architecture.
  • Clean iOS build of an app using @react-native-firebase/{app,analytics,crashlytics,messaging} — compiles without the RCT_USE_PREBUILT_RNCORE=0 workaround.
  • Ruby syntax check on all podspecs (ruby -c) — passing.

…s for use_frameworks! (RN 0.84+)

RN 0.83+ ships a prebuilt React-Core, enabled by default on 0.84+ via
RCT_USE_PREBUILT_RNCORE=1. Two problems break RNFB iOS builds:

1. Header resolution: the legacy <React/...> imports in RNFB's Objective-C
   sources need the prebuilt React-Core wired via React Native's
   add_rncore_dependency helper. Called here, guarded with defined? so older
   react-native versions are unaffected.

2. Framework module validation: when a consumer builds with use_frameworks!
   (Expo's default, and required by the firebase-ios-sdk), RNFB compiles as a
   framework module and Clang rejects the non-modular <React/...> includes with
   -Wnon-modular-include-in-framework-module ("must be imported from module
   'React'"). Setting CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES=YES
   lets the module validate.

The xcconfig is merged into any existing pod_target_xcconfig so per-package
settings (e.g. generated TurboModule header search paths) are preserved.

This removes the need for the RCT_USE_PREBUILT_RNCORE=0 workaround that forces
React-Core to be rebuilt from source.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@mikehardy

Copy link
Copy Markdown
Collaborator

Hey 👋 thanks for this -

Quick note to say before we look at this, it is going to have to wait for the SPM support to land (it's reviewed+approved and just needs merge):

...which is itself waiting on v26 to launch (there will be a PR for some fixes there, it's about ready to go)

So, hopefully not long, and it's our next priority to fix after SPM lands but it will probably be a conflict bonanza once SPM does land

@mikehardy mikehardy added the Workflow: Needs Review Pending feedback or review from a maintainer. label Jul 28, 2026
@aravi365

Copy link
Copy Markdown
Author

Hey 👋 thanks for this -

Quick note to say before we look at this, it is going to have to wait for the SPM support to land (it's reviewed+approved and just needs merge):

...which is itself waiting on v26 to launch (there will be a PR for some fixes there, it's about ready to go)

So, hopefully not long, and it's our next priority to fix after SPM lands but it will probably be a conflict bonanza once SPM does land

Thanks @mikehardy, makes sense to wait for SPM to land first. Happy to rebase and clean up the conflicts once it's in, just give me a shout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Workflow: Needs Review Pending feedback or review from a maintainer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants