react-native-navigation的迁移库

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #import "AppDelegate.h"
  2. // **********************************************
  3. // *** DON'T MISS: THE NEXT LINE IS IMPORTANT ***
  4. // **********************************************
  5. #import <ReactNativeNavigation/ReactNativeNavigation.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 <React/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. [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
  22. /*
  23. // original RN bootstrap - remove this part
  24. RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
  25. moduleName:@"com.example.WelcomeScreen"
  26. initialProperties:nil
  27. launchOptions:launchOptions];
  28. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  29. UIViewController *rootViewController = [UIViewController new];
  30. rootViewController.view = rootView;
  31. self.window.rootViewController = rootViewController;
  32. [self.window makeKeyAndVisible];
  33. */
  34. return YES;
  35. }
  36. @end