Created
February 23, 2016 10:00
-
-
Save benvium/47283efabf795e93316a to your computer and use it in GitHub Desktop.
React Native iOS Smooth Splash Screen (when using LaunchScreen.xib)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
... | |
... | |
... | |
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation | |
moduleName:@"MyAwesomeApp" | |
initialProperties:@{} | |
launchOptions:launchOptions]; | |
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
UIViewController *rootViewController = [UIViewController new]; | |
rootViewController.view = rootView; | |
self.window.rootViewController = rootViewController; | |
[self.window makeKeyAndVisible]; | |
// re-load the LaunchScreen to prevent white screen showing before your app renders | |
UIView* launchScreen = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] objectAtIndex:0]; | |
launchScreen.frame = [UIScreen mainScreen].bounds; | |
rootView.loadingView = launchScreen; | |
rootView.loadingViewFadeDelay = 0.20; | |
rootView.loadingViewFadeDuration = 0.30; | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment