react-native-splash-screen icon indicating copy to clipboard operation
react-native-splash-screen copied to clipboard

Fix show in iOS

Open josei opened this issue 5 years ago • 4 comments

This commit fixes show function, which does not bring back splash screen in iOS.

josei avatar May 27 '20 16:05 josei

This is something working; It brings a new limitation: call in ios level should be to showSplash function instead show

OneStromberg avatar Oct 21 '20 13:10 OneStromberg

This is something working; It brings a new limitation: call in ios level should be to showSplash function instead show

This PR doesn't work for me... When you mention showSplash, do you mean this one in AppDelegate.m? Or from actual JS code??

  ...

  [super application:application didFinishLaunchingWithOptions:launchOptions];

  // Used to be show [RNSplashScreen show];
  [RNSplashScreen showSplash];

  return YES;
}

sungsong88 avatar Nov 08 '20 16:11 sungsong88

@OneStromberg You r right! It has to be [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; now. @crazycodeboy Please merge this PR in. This works perfectly.

For any EXPO bare users who are looking forward to applying this PR, there is where you should put that [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; line in AppDelegate.m:

- (RCTBridge *)initializeReactNativeApp
{
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  // HERE!!!!*****************************
  [RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
  // *****************************

  return bridge;
}

Also, don't forget to update LaunchScreen.xib file in the way u want!(Make it looks like your SplashScreen) Otherwise your splash screen will be like My App Powered by React Native with white background. 😂😂😂 image

sungsong88 avatar Nov 08 '20 18:11 sungsong88

it does not work. the app was forced out

nazacity avatar Jan 03 '21 06:01 nazacity