crazycodeboy / react-native-splash-screen

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

Hiding Splashscreen Automatically in IOS. #598

Open anshif10 opened 1 year ago

anshif10 commented 1 year ago
clay-aiken commented 1 year ago

Same issue here, Splash Screen did not wait until "hide" function call and its hide automatically. Don't matter in IOS or Android. Any solutions for this issue?

thisisadarshjais commented 1 year ago

Any update here??

zoobibackups commented 1 year ago

I think you have forgot the native setup.

#import "AppDelegate.h"
#import <Firebase.h>
#import "RNSplashScreen.h"
#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleName = @"TrueCaller";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};
  [FIRApp configure];
  bool didFinish=[super application:application didFinishLaunchingWithOptions:launchOptions]; // added 
  [RNSplashScreen show];  // here
  return didFinish; // added 
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end
abh1abii commented 5 months ago

One observation I have on the iOS simulator. If you press "R" on the metro terminal to reload the app, it will autohide without waiting for the SplashScreen.hide() to be called. If you kill the app and relaunch instead of reloading, it will wait for the hide function to be called. Which should be fine given that you can only reload the app in this flow during development.