react-native-navigation的迁移库

AppDelegate.m 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "AppDelegate.h"
  10. #import "RCTRootView.h"
  11. @implementation AppDelegate
  12. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  13. {
  14. NSURL *jsCodeLocation;
  15. /**
  16. * Loading JavaScript code - uncomment the one you want.
  17. *
  18. * OPTION 1
  19. * Load from development server. Start the server from the repository root:
  20. *
  21. * $ npm start
  22. *
  23. * To run on device, change `localhost` to the IP address of your computer
  24. * (you can get this by typing `ifconfig` into the terminal and selecting the
  25. * `inet` value under `en0:`) and make sure your computer and iOS device are
  26. * on the same Wi-Fi network.
  27. */
  28. jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
  29. /**
  30. * OPTION 2
  31. * Load from pre-bundled file on disk. The static bundle is automatically
  32. * generated by "Bundle React Native code and images" build step.
  33. */
  34. // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  35. RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
  36. moduleName:@"exampleRedux"
  37. initialProperties:nil
  38. launchOptions:launchOptions];
  39. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  40. UIViewController *rootViewController = [UIViewController new];
  41. rootViewController.view = rootView;
  42. self.window.rootViewController = rootViewController;
  43. [self.window makeKeyAndVisible];
  44. return YES;
  45. }
  46. @end