Skip to content

Instantly share code, notes, and snippets.

@brentvatne
Created December 16, 2021 18:41
Show Gist options
  • Save brentvatne/7bd791e9a4fdcea54cc7d2b771966cc0 to your computer and use it in GitHub Desktop.
Save brentvatne/7bd791e9a4fdcea54cc7d2b771966cc0 to your computer and use it in GitHub Desktop.
diff --git a/ios/example/AppDelegate.m b/ios/example/AppDelegate.m
index 1b72e8c..3ddedd1 100644
--- a/ios/example/AppDelegate.m
+++ b/ios/example/AppDelegate.m
@@ -33,17 +33,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
InitializeFlipper(application);
#endif
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
- id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
- if (rootViewBackgroundColor != nil) {
- rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
- } else {
- rootView.backgroundColor = [UIColor whiteColor];
- }
-
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
+ RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
+ rootView.backgroundColor = [UIColor whiteColor];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
+ UIViewController *rootViewController = [self.reactDelegate createRootViewController];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment