Skip to content

Instantly share code, notes, and snippets.

@lukebrandonfarrell
Last active April 13, 2021 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebrandonfarrell/780d53d7f65bc1723d3aa3a8a0846cbc to your computer and use it in GitHub Desktop.
Save lukebrandonfarrell/780d53d7f65bc1723d3aa3a8a0846cbc to your computer and use it in GitHub Desktop.
Perfect splash screen for iOS in React Native with fade animation (no dependancies!)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"MyApp" initialProperties:nil];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
UIView* launchScreen = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] objectAtIndex:0];
rootView.loadingView = launchScreen;
rootView.loadingViewFadeDuration = 0.30;
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment