react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Support for Expo Modules

Open eliaslecomte opened this issue 2 years ago • 13 comments

🐛 Bug Report

We use wix/react-native-navigation together with Expo, and it works like a charm. However, since Expo upgraded from their react-native-unimodules to Expo Modules, it looks impossible to use these together.

Links:

  • https://docs.expo.dev/bare/installing-expo-modules/
  • https://blog.expo.dev/whats-new-in-expo-modules-infrastructure-7a7cdda81ebc#7486

Any help on using these together?

eliaslecomte avatar Mar 21 '22 08:03 eliaslecomte

https://github.com/kanzitelli/rnn-with-expo

Pietro-Putelli avatar Mar 21 '22 10:03 Pietro-Putelli

So how to use expo with react-native-navigation?

There should be

@Override
  protected ReactActivityDelegate createReactActivityDelegate() {
    // INIT https://docs.expo.dev/bare/installing-expo-modules/#configuration-for-android
    return new ReactActivityDelegateWrapper(this, new MainActivityDelegate(this, getMainComponentName()));
  }

But NavigationActivity doesn't have createReactActivityDelegate to override.

So my app is stuck on the first screen.

gen1lee avatar Jun 15 '22 20:06 gen1lee

@Pietro-Putelli Thanks for help, one thing to notice, I was unable to solve any issues until jumped to RN0.70.0, nothing works after 0.67.5, 0.68.0 does not compile for android builds but I successfully compile ios and android with RN0.70.0 and looks like I have another issue with overlay on android, but it is another story for research.

LYevhen avatar Feb 17 '23 20:02 LYevhen

Hi, I was able to install it with npx init and install expo modules too, use version 0.70 and then once run it will ask you to update the version, and from here you can bring the app up to date.

Pietro-Putelli avatar Feb 17 '23 20:02 Pietro-Putelli

Is there any tutorial somewhere to install expo with react native navigation in react native 0.72+?

JimTeva avatar Nov 24 '23 00:11 JimTeva

@JimTeva I'm having the same issue trying to upgrade to 0.72...any luck? iOS app crashes at launch with *** Terminating app due to uncaught exception 'RCTFatalException: No bundle URL present.

marcshilling avatar Dec 14 '23 17:12 marcshilling

@marcshilling unfortunately I didn't find a solution as it requires a custom integration. I wish @kanzitelli could make a manual on how to do it as he succeeded in making a starter that includes both. @kanzitelli?

JimTeva avatar Dec 14 '23 17:12 JimTeva

@JimTeva to update, I managed to get everything running on RN 0.72! Basically just needed to leave most of the AppDelegate/MainApplication code the same as RNN docs recommend (contrary to what the upgrade helper says). If anyone else needs help, happy to answer any questions.

marcshilling avatar Dec 19 '23 15:12 marcshilling

@marcshilling I'd love some guidance with this, can you point us to the changes that need to take place from a high level so that I can get started with making those changes on our project?

I'd be grateful! Thanks

SudoPlz avatar Jan 09 '24 13:01 SudoPlz

@SudoPlz https://github.com/kanzitelli/rnn-with-expo is pretty much the correct setup except with RN 0.72 I had to change the AppDelegate lines slightly to this:

RCTBridge *bridge = [self createBridgeWithDelegate:self launchOptions:launchOptions];
[ReactNativeNavigation bootstrapWithBridge:bridge];

marcshilling avatar Jan 09 '24 17:01 marcshilling

@marcshilling my main concern with that implementation is:

  1. https://github.com/kanzitelli/rnn-starter/issues/57#issuecomment-1883372245 ReactNativeHostWrapper is not used at all, that means on Android it's probably not properly integrated

  2. on iOS it replaces RCTAppDelegate with EXAppDelegateWrapper. But I'm not sure wether this works with fabric, since by doing a quick check, EXAppDelegateWrapper does not implement the same functionality as RCTAppDelegate (RCTAppDelegate methods missing from EXAppDelegateWrapper). I could be wrong about this but it's a concern, because we have enabled fabric in our project.

SudoPlz avatar Jan 09 '24 17:01 SudoPlz

@SudoPlz ah, I'm not using the new architecture so can't help you there...sorry

marcshilling avatar Jan 09 '24 19:01 marcshilling