react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #import "AppDelegate.h"
  2. #import "RNNCustomViewController.h"
  3. // **********************************************
  4. // *** DON'T MISS: THE NEXT LINE IS IMPORTANT ***
  5. // **********************************************
  6. #import <React/RCTBundleURLProvider.h>
  7. #import <ReactNativeNavigation/ReactNativeNavigation.h>
  8. // IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install"
  9. // with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1)
  10. #import <React/RCTRootView.h>
  11. @implementation AppDelegate
  12. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  13. {
  14. // **********************************************
  15. // *** DON'T MISS: THIS IS HOW WE BOOTSTRAP *****
  16. // **********************************************
  17. NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
  18. [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
  19. [ReactNativeNavigation registerExternalComponent:@"RNNCustomComponent" callback:^UIViewController *(NSDictionary *props, RCTBridge *bridge) {
  20. return [[RNNCustomViewController alloc] initWithProps:props];
  21. }];
  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