AppDelegate.m 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #import "AppDelegate.h"
  2. #import <React/RCTBridge.h>
  3. #import <React/RCTBundleURLProvider.h>
  4. #import <React/RCTRootView.h>
  5. // #if DEBUG
  6. // #import <FlipperKit/FlipperClient.h>
  7. // #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
  8. // #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
  9. // #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
  10. // #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
  11. // #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
  12. // static void InitializeFlipper(UIApplication *application) {
  13. // FlipperClient *client = [FlipperClient sharedClient];
  14. // SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  15. // [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  16. // [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  17. // [client addPlugin:[FlipperKitReactPlugin new]];
  18. // [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  19. // [client start];
  20. // }
  21. // #endif
  22. @implementation AppDelegate
  23. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  24. {
  25. // #if DEBUG
  26. // InitializeFlipper(application);
  27. // #endif
  28. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  29. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  30. moduleName:@"SafeAreaViewExample"
  31. initialProperties:nil];
  32. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  33. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  34. UIViewController *rootViewController = [UIViewController new];
  35. rootViewController.view = rootView;
  36. self.window.rootViewController = rootViewController;
  37. [self.window makeKeyAndVisible];
  38. return YES;
  39. }
  40. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  41. {
  42. #if DEBUG
  43. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil];
  44. #else
  45. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  46. #endif
  47. }
  48. @end