AppDelegate.m 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "RNSplashScreen.h"
  8. #import "AppDelegate.h"
  9. #import <React/RCTBridge.h>
  10. #import <React/RCTBundleURLProvider.h>
  11. #import <React/RCTRootView.h>
  12. @implementation AppDelegate
  13. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  14. {
  15. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  16. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  17. moduleName:@"una"
  18. initialProperties:nil];
  19. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  20. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  21. UIViewController *rootViewController = [UIViewController new];
  22. rootViewController.view = rootView;
  23. self.window.rootViewController = rootViewController;
  24. [self.window makeKeyAndVisible];
  25. [RNSplashScreen show];
  26. return YES;
  27. }
  28. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  29. {
  30. #if DEBUG
  31. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  32. #else
  33. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  34. #endif
  35. }
  36. @end