config-plugins icon indicating copy to clipboard operation
config-plugins copied to clipboard

React-native-branch incompatibility with Expo SDK 53: iOS Build fails with "cannot find type 'RCTBridge' in scope"

Open JoanFruitet opened this issue 5 months ago • 1 comments
trafficstars

Summary

EAS Build for iOS fails when using Expo SDK from 53, @config-plugins/react-native-branch (v10.0.0) and react-native-branch. The error is:

error: cannot find type 'RCTBridge' in scope
AppDelegate.swift: override func sourceURL(for bridge: RCTBridge) -> URL? {

The build works perfectly with Expo SDK 52 and @config-plugins/react-native-branch V9.0.0 Disabling the new architecture ("newArchEnabled": false) does not solve the issue. The project is managed (no local ios/ folder), using EAS Build. No custom native code All dependencies are aligned with the official compatibility table.

Config Plugin

@config-plugins/react-native-branch

What platform(s) does this occur on?

iOS

SDK Version

53

Reproducible demo

  • Create a new Expo SDK 53 project.
  • Install react-native-branch and @config-plugins/react-native-branch.
  • Add the recommended configuration to app.json.
  • Run an EAS Build for iOS.

JoanFruitet avatar Jun 17 '25 12:06 JoanFruitet

I have the same issue upgrading to Expo SDK 53 and can't seem to find anywhere whether Branch supports the new architecture.

On Android, it builds successfully.

Some advice would be very helpful.

azzadrood avatar Jun 27 '25 13:06 azzadrood

We're SOL https://github.com/expo/config-plugins/issues/270

arapocket avatar Jul 10 '25 09:07 arapocket

I’m also encountering this issue on Expo SDK 53 (@config-plugins/[email protected] + [email protected]) with the same RCTBridge error on iOS.

The urgency for fixing this is increasing because Google Play Console now requires all apps to target Android 15 (API level 35) by August 31. Upgrading to Expo SDK 53 is currently the only viable path to comply with this, but this Branch-related issue blocks that upgrade.

If there’s no timely resolution, we might be forced to consider removing Branch from our app, which would be unfortunate given its usefulness.

Anyone else in the same situation, I encourage you to also submit a support ticket to Branch, since Expo maintainers have clarified they cannot fix this from their side.

danielcollsol avatar Jul 27 '25 18:07 danielcollsol

I’m also encountering this issue on Expo SDK 53 (@config-plugins/[email protected] + [email protected]) with the same RCTBridge error on iOS.

The urgency for fixing this is increasing because Google Play Console now requires all apps to target Android 15 (API level 35) by August 31. Upgrading to Expo SDK 53 is currently the only viable path to comply with this, but this Branch-related issue blocks that upgrade.

If there’s no timely resolution, we might be forced to consider removing Branch from our app, which would be unfortunate given its usefulness.

Anyone else in the same situation, I encourage you to also submit a support ticket to Branch, since Expo maintainers have clarified they cannot fix this from their side.

Hi! You can target API level 35 with Expo SDK 52 by using the expo-build-properties plugin and setting it manually in your config:

"plugins": ["expo-build-properties"],
"expo-build-properties": {
  "android": {
    "targetSdkVersion": 35
  }
}

It worked for me :-)

JoanFruitet avatar Jul 27 '25 20:07 JoanFruitet

We're also looking for alternatives to Branch right now. It's too bad the Firebase Dynamic Link is shutting down...

yshuang avatar Jul 31 '25 09:07 yshuang

I’m also encountering this issue on Expo SDK 53 (@config-plugins/[email protected] + [email protected]) with the same RCTBridge error on iOS. The urgency for fixing this is increasing because Google Play Console now requires all apps to target Android 15 (API level 35) by August 31. Upgrading to Expo SDK 53 is currently the only viable path to comply with this, but this Branch-related issue blocks that upgrade. If there’s no timely resolution, we might be forced to consider removing Branch from our app, which would be unfortunate given its usefulness. Anyone else in the same situation, I encourage you to also submit a support ticket to Branch, since Expo maintainers have clarified they cannot fix this from their side.

Hi! You can target API level 35 with Expo SDK 52 by using the expo-build-properties plugin and setting it manually in your config:

"plugins": ["expo-build-properties"],
"expo-build-properties": {
  "android": {
    "targetSdkVersion": 35
  }
}

It worked for me :-)

Thanks for the tip — that’s super helpful!

If targeting API level 35 works reliably with SDK 52 using expo-build-properties, that could buy us a bit of time while the Branch issue on SDK 53 gets sorted out. I’ll test it out and see if it passes Play Console checks.

Appreciate you sharing it!

danielcollsol avatar Aug 03 '25 18:08 danielcollsol

We’re currently stuck on this issue, and it needs to be resolved as soon as possible.

mudassir-rafiq-007 avatar Aug 13 '25 09:08 mudassir-rafiq-007

same problem here, waiting solution...

gustavoclay avatar Aug 13 '25 17:08 gustavoclay

Same issue.

itsalysialynn avatar Aug 26 '25 19:08 itsalysialynn

I opened a support ticket with branch.io and they closed it with a generic response as expected. Still holding onto hope.

shanekunz avatar Aug 28 '25 14:08 shanekunz

This happens because the Swift bridging header does not automatically import RCTBridge. I ran into this while running npx expo prebuild and the build kept failing with errors like

cannot find type 'RCTBridge' in scope

Good news is I found a workaround using a custom Expo config plugin.

Solution:

  1. Create a plugin file (e.g., ./plugins/withReactBridgeHeader.js):
const fs = require('fs');
const path = require('path');

const withReactBridgeHeader = (config) => {
  return {
    ...config,
    ios: {
      ...config.ios,
      hooks: {
        postPrebuild: () => {
          const iosDir = config.ios?.projectPath || 'ios';
          const headerFile = path.join(iosDir, config.name, `${config.name}-Bridging-Header.h`);

          if (fs.existsSync(headerFile)) {
            let content = fs.readFileSync(headerFile, 'utf-8');
            const importLine = '#import <React/RCTBridge.h>';

            if (!content.includes(importLine)) {
              content = content + '\n' + importLine;
              fs.writeFileSync(headerFile, content, 'utf-8');
              console.log('[withReactBridgeHeader] Added React import to bridging header');
            }
          } else {
            console.warn(`[withReactBridgeHeader] Bridging header not found at ${headerFile}`);
          }
        },
      },
    },
  };
};

module.exports = withReactBridgeHeader;
  1. Use the plugin in your app.config.js:
const withReactBridgeHeader = require('./plugins/withReactBridgeHeader');

export default {
  expo: {
    name: "YourApp",
    slug: "your-app",
    plugins: [
      // other plugins...
      withReactBridgeHeader,
    ],
  },
};
  1. Clean and rebuild the project:
rm -rf ios/Pods ios/Podfile.lock ios/Podfile.xcworkspace ios/build
npx expo prebuild --clean
cd ios && pod install && cd ..
npx expo run:ios

This ensures the bridging header includes the necessary import, so your Swift code compiles correctly after prebuilds.

Let me know if that worked for you!

briansztamfater avatar Aug 29 '25 20:08 briansztamfater

Have the same issue with expo 54

MoeMamdouh avatar Sep 22 '25 08:09 MoeMamdouh

@hassankhan Any plan to support branch in Expo v54

MoeMamdouh avatar Sep 22 '25 08:09 MoeMamdouh

@hassankhan Any plan to support branch in Expo v54

The branch seems to be ready https://github.com/expo/config-plugins/tree/upgrade-to-v54-stacked I'm waiting for the PR ... 👀

davidavz avatar Sep 22 '25 08:09 davidavz

@hassankhan Any plan to support branch in Expo v54

The branch seems to be ready upgrade-to-v54-stacked I'm waiting for the PR ... 👀

So, does this mean this entire GitHub issue is expected to be resolved for Expo v54?

shanekunz avatar Sep 22 '25 21:09 shanekunz

So, does this mean this entire GitHub issue is expected to be resolved for Expo v54?

There appears to be code to add the necessary bridge header similar to the workaround @briansztamfater posted (which we've been using for expo 53).

So that should both support expo 54 (bumping versions) and workaround the RCTBridge issue (which seems to be more of a react-native-branch issue than the config plugin itself)

jaredschlichtcleo avatar Sep 23 '25 01:09 jaredschlichtcleo

I also experienced the same issue with the latest Expo version ^54.0.10. Looking forward to the fix whenever it’s ready. 🙌

dcatindoy avatar Sep 23 '25 06:09 dcatindoy

Hi @hassankhan, thanks for the earlier work on this issue 🙏.

I just wanted to note that I’m still experiencing the same problem on Expo SDK 54 after pulling the latest changes. The error persists during EAS Build for iOS.

Environment:

  • Expo SDK: 54
  • @config-plugins/react-native-branch: ^11.0.0
  • react-native-branch: ^6.8.0

To help with debugging, I’ve put together:

Could you confirm if support for SDK 54 is expected, or if additional configuration steps are needed?

dcatindoy avatar Oct 02 '25 10:10 dcatindoy