diff options
Diffstat (limited to 'ios/app')
-rw-r--r-- | ios/app/AppDelegate.h | 6 | ||||
-rw-r--r-- | ios/app/AppDelegate.mm | 97 |
2 files changed, 12 insertions, 91 deletions
diff --git a/ios/app/AppDelegate.h b/ios/app/AppDelegate.h index ef1de86a2..5d2808256 100644 --- a/ios/app/AppDelegate.h +++ b/ios/app/AppDelegate.h @@ -1,8 +1,6 @@ -#import <React/RCTBridgeDelegate.h> +#import <RCTAppDelegate.h> #import <UIKit/UIKit.h> -@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate> - -@property (nonatomic, strong) UIWindow *window; +@interface AppDelegate : RCTAppDelegate @end diff --git a/ios/app/AppDelegate.mm b/ios/app/AppDelegate.mm index c73bc099d..7c0e1d8de 100644 --- a/ios/app/AppDelegate.mm +++ b/ios/app/AppDelegate.mm @@ -1,10 +1,6 @@ #import "AppDelegate.h" -#import <React/RCTBridge.h> #import <React/RCTBundleURLProvider.h> -#import <React/RCTRootView.h> - -#import <React/RCTAppSetupUtils.h> // universal links #import <React/RCTLinkingManager.h> @@ -12,59 +8,15 @@ // splash screen #import "RNSplashScreen.h" -#if RCT_NEW_ARCH_ENABLED -#import <React/CoreModulesPlugins.h> -#import <React/RCTCxxBridgeDelegate.h> -#import <React/RCTFabricSurfaceHostingProxyRootView.h> -#import <React/RCTSurfacePresenter.h> -#import <React/RCTSurfacePresenterBridgeAdapter.h> -#import <ReactCommon/RCTTurboModuleManager.h> - -#import <react/config/ReactNativeConfig.h> - -@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> { - RCTTurboModuleManager *_turboModuleManager; - RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; - std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig; - facebook::react::ContextContainer::Shared _contextContainer; -} -@end -#endif - @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - RCTAppSetupPrepareApp(application); - - RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; - -#if RCT_NEW_ARCH_ENABLED - _contextContainer = std::make_shared<facebook::react::ContextContainer const>(); - _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>(); - _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); - _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; - bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; -#endif - - UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"xyz.blueskyweb.app", nil); - - if (@available(iOS 13.0, *)) { - rootView.backgroundColor = [UIColor systemBackgroundColor]; - } else { - rootView.backgroundColor = [UIColor whiteColor]; - } - - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - // Show the splash screen - [RNSplashScreen show]; + // [RNSplashScreen show]; - return YES; + self.moduleName = @"xyz.blueskyweb.app"; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge @@ -76,45 +28,16 @@ #endif } -#if RCT_NEW_ARCH_ENABLED - -#pragma mark - RCTCxxBridgeDelegate - -- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge +/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. +/// +/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html +/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). +/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`. +- (BOOL)concurrentRootEnabled { - _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge - delegate:self - jsInvoker:bridge.jsCallInvoker]; - return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); + return true; } -#pragma mark RCTTurboModuleManagerDelegate - -- (Class)getModuleClassFromName:(const char *)name -{ - return RCTCoreModulesClassProvider(name); -} - -- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name - jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker -{ - return nullptr; -} - -- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name - initParams: - (const facebook::react::ObjCTurboModule::InitParams &)params -{ - return nullptr; -} - -- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass -{ - return RCTAppSetupDefaultModuleFromClass(moduleClass); -} - -#endif - // universal links - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url |