crazycodeboy / react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
MIT License
5.6k stars 1.09k forks source link

How can i install this with react-native-navigation IOS #388

Open acollazomayer opened 5 years ago

acollazomayer commented 5 years ago

I want to install this library along react-native-navigation but I dont know how to modify the AppDelegate. How can i do this. Thanks.

binhndicts commented 5 years ago

@acollazomayer You can put the setup line of splash-screen right above return command of didFinishLaunchingWithOptions

Dexwell commented 5 years ago

Have any of you gotten this to work with RN 0.59 and RNN 2.18.1? My didFinishLaunchingWithOptions looks like this:

// React Native
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

// React Native Splash Screen
[RNSplashScreen show];

// React Native Navigation
[ReactNativeNavigation bootstrap:[self sourceURLForBridge: bridge] launchOptions:launchOptions];

return YES;

But my JS code is never executed, so SplashScreen.hide() is never called and I'm stuck on the launch screen.

leanhanc commented 5 years ago

@Dexwell I just changed the order of the statements and it works. First the Navigation and then the show Splash Screen.

Still not 100% sure if I'm losing the functionallity or not but I can confirm that the hide method is being called and effectively hiding the splash screen.

Dexwell commented 5 years ago

@leo10099 I don't understand, nothing happens when I change the order. You're using the latest versions of RN, RNN, and RNSS mentioned above? What does your index.js look like?

leanhanc commented 5 years ago

@Dexwell This is what I am using

"react-native": "0.59.5",
"react-native-navigation": "2.18.2",
"react-native-splash-screen": "3.0.6",

You can see the working code in this repo

Dexwell commented 5 years ago

If someone else has the same problem, this fixed it for me: https://github.com/wix/react-native-navigation/issues/5016#issuecomment-488615523