Skip to content

🔥 [🐛] iOS build fails: cannot find 'RCTPromiseRejectBlock' in scope in RNFBFirestoreCommon.h (v24 + Expo SDK 55 + use_frameworks!:static) #8988

@cathandnya

Description

@cathandnya

Issue

On iOS, building an Expo SDK 55 / React Native 0.83.4 app that uses @react-native-firebase/firestore@24.0.0 with use_frameworks!: :static fails with:

node_modules/@react-native-firebase/firestore/ios/RNFBFirestore/RNFBFirestoreCommon.h:40:42:
  error: cannot find 'RCTPromiseRejectBlock' in scope
+ (void)promiseRejectFirestoreException:(RCTPromiseRejectBlock)reject error:(NSError *)error;
                                         ^

Similar errors are also raised in RNFBFirestoreCollectionModule.h and the other Firestore headers that expose methods taking RCTPromiseRejectBlock / RCTResponseSenderBlock.

Root cause

Two separate issues in the shipped iOS sources of @react-native-firebase/firestore@24.0.0:

  1. Header import order. In every .h under ios/RNFBFirestore/, #import <Firebase/Firebase.h> is placed before #import <React/RCTBridgeModule.h>:

    // RNFBFirestoreCommon.h (current)
    #import <Firebase/Firebase.h>
    #import <React/RCTBridgeModule.h>

    With Expo's default use_frameworks!: :static + Xcode 26, resolving Firebase first seems to prevent React/RCTBridgeModule.h from contributing its block typedefs into scope, so RCTPromiseRejectBlock / RCTResponseSenderBlock are not visible to later declarations in the same file.

  2. Missing import in .m sources. Several implementation files call RCTPromiseRejectBlock / RCTResponseSenderBlock but never import <React/RCTBridgeModule.h> directly — they were relying on the header chain picking it up. Affected files:

    • RNFBFirestoreCollectionModule.m
    • RNFBFirestoreCommon.m
    • RNFBFirestoreDocumentModule.m
    • RNFBFirestoreModule.m
    • RNFBFirestoreTransactionModule.m

Why this is not #8883

#8883 covers RN 0.84's pre-compiled rncore colliding with RNFB modulemaps across all RNFB pods (Auth / Messaging / Firestore etc.). This project runs RN 0.83.4, where RCT_USE_PREBUILT_RNCORE is not set and the pre-compiled default is off. Also only @react-native-firebase/firestore failed to compile — @react-native-firebase/app and @react-native-firebase/auth built without any patch. The workaround for #8883 (Podfile preinstall hook to force-static RNFB, or RCT_USE_PREBUILT_RNCORE=0) does not address the import declarations in Firestore sources.

Steps to reproduce

  1. Create an Expo SDK 55 app (RN 0.83.4) with use_frameworks!: :static, Xcode 26 / iOS 15.1 deployment target.
  2. Install @react-native-firebase/app@^24, @react-native-firebase/auth@^24, @react-native-firebase/firestore@^24.
  3. npx expo prebuild --clean && npx expo run:ios.
  4. Build fails at RNFBFirestoreCommon.h:40 with cannot find 'RCTPromiseRejectBlock' in scope.

Workaround applied (patch-package style)

Two edits across the Firestore iOS sources:

a) Reorder .h imports so React comes before Firebase

-#import <Firebase/Firebase.h>
-#import <React/RCTBridgeModule.h>
+#import <React/RCTBridgeModule.h>
+#import <Firebase/Firebase.h>

Applied to every file under ios/RNFBFirestore/ that imports both (RNFBFirestoreCommon.h, RNFBFirestoreCollectionModule.h, RNFBFirestoreDocumentModule.h, RNFBFirestoreModule.h, RNFBFirestoreQuery.h, RNFBFirestoreSerialize.h, RNFBFirestoreTransactionModule.h).

b) Add <React/RCTBridgeModule.h> to each .m that uses RCTPromiseRejectBlock / RCTResponseSenderBlock

+#import <React/RCTBridgeModule.h>
 #import <RNFBApp/RNFBRCTEventEmitter.h>

Applied to the five .m files listed above.

After these two edits, npx expo run:ios succeeds and Firestore reads/writes (including emulator-based E2E) pass.


Project Files

Javascript

Click To Expand

package.json (excerpt):

```json
{
"dependencies": {
"expo": "~55.0.15",
"react": "19.2.0",
"react-native": "0.83.4",
"@react-native-firebase/app": "24.0.0",
"@react-native-firebase/auth": "24.0.0",
"@react-native-firebase/firestore": "24.0.0"
}
}
```

iOS

Click To Expand

ios/Podfile.properties.json:

```json
{
"expo.jsEngine": "hermes",
"ios.deploymentTarget": "15.1",
"ios.useFrameworks": "static"
}
```

Podfile itself is generated by Expo prebuild and is not manually customized.


Environment

  • Platform: iOS (not tested on Android; Android builds are green with the same package versions in our project)
  • react-native-firebase version: 24.0.0 for app, auth, firestore
  • Firebase module(s) with the issue: firestore (auth and app build fine without any patch)
  • TypeScript: Y, ~5.9.2
  • React Native: 0.83.4 (Expo SDK 55)
  • Xcode: 26.0.1 on macOS 26.4
  • iOS deployment target: 15.1
  • use_frameworks!: :static (via expo-build-properties)
  • RCT_USE_PREBUILT_RNCORE not set (RN 0.83 default)

`react-native info` is tricky to produce from a fully-Expo project; happy to supply a sample repo if useful.


Thanks for maintaining this library. Let me know if you'd like a PR that just reorders the imports and adds the missing <React/RCTBridgeModule.h> in the five .m sources — the change is mechanical and non-breaking on older RN versions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions