Skip to content

Instantly share code, notes, and snippets.

@glocore
Last active March 6, 2021 07:34
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 glocore/968bc41b3404d5cc7c5a2feda10e5c97 to your computer and use it in GitHub Desktop.
Save glocore/968bc41b3404d5cc7c5a2feda10e5c97 to your computer and use it in GitHub Desktop.
React Native Navigation (RNN) manual installation for iOS
 #import <React/RCTBundleURLProvider.h>
 #import <React/RCTRootView.h>
 #import <React/RCTLinkingManager.h>
+#import <ReactNativeNavigation/ReactNativeNavigation.h>

 #import <UMCore/UMModuleRegistry.h>
 #import <UMReactNativeAdapter/UMNativeModulesProxy.h>

 - (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];
-
-  return bridge;
+  [ReactNativeNavigation bootstrapWithDelegate:self launchOptions:self.launchOptions];
+  return [ReactNativeNavigation getBridge];
}

 - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
 {
   NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
   // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
-  return extraModules;
+  return [extraModules arrayByAddingObjectsFromArray:[ReactNativeNavigation extraModulesForBridge:bridge]];
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment