react-native-navigation的迁移库

AppDelegate.m 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #import "AppDelegate.h"
  2. // **********************************************
  3. // *** DON'T MISS: THE NEXT LINE IS IMPORTANT ***
  4. // **********************************************
  5. #import "RCCManager.h"
  6. // IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install"
  7. // with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1)
  8. #import "RCTRootView.h"
  9. @implementation AppDelegate
  10. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  11. {
  12. NSURL *jsCodeLocation;
  13. #ifdef DEBUG
  14. jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
  15. #else
  16. jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  17. #endif
  18. // **********************************************
  19. // *** DON'T MISS: THIS IS HOW WE BOOTSTRAP *****
  20. // **********************************************
  21. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  22. self.window.backgroundColor = [UIColor whiteColor];
  23. [[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation];
  24. /*
  25. // original RN bootstrap - remove this part
  26. RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
  27. moduleName:@"example"
  28. initialProperties:nil
  29. launchOptions:launchOptions];
  30. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  31. UIViewController *rootViewController = [UIViewController new];
  32. rootViewController.view = rootView;
  33. self.window.rootViewController = rootViewController;
  34. [self.window makeKeyAndVisible];
  35. */
  36. return YES;
  37. }
  38. @end