12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "AppDelegate.h"
  8. #import <React/RCTBridge.h>
  9. #import <React/RCTBundleURLProvider.h>
  10. #import <React/RCTRootView.h>
  11. @implementation AppDelegate
  12. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  13. {
  14. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  15. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  16. moduleName:@"SafeAreaViewExample"
  17. initialProperties:nil];
  18. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  19. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  20. UIViewController *rootViewController = [UIViewController new];
  21. rootViewController.view = rootView;
  22. self.window.rootViewController = rootViewController;
  23. [self.window makeKeyAndVisible];
  24. return YES;
  25. }
  26. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  27. {
  28. #if DEBUG
  29. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil];
  30. #else
  31. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  32. #endif
  33. }
  34. @end