diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-01-17 20:21:11 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-01-17 20:21:11 -0600 |
commit | a13f9bf0916f80417ea20cc98ad86fe51f1a60dd (patch) | |
tree | f124df035d35e80ce287c9ee87b034e2e8382b16 /ios/app/AppDelegate.mm | |
parent | b449ab842fc64177f8ba1e17199911f02cb99526 (diff) | |
download | voidsky-a13f9bf0916f80417ea20cc98ad86fe51f1a60dd.tar.zst |
Upgrade to react-native 0.71.0
Diffstat (limited to 'ios/app/AppDelegate.mm')
-rw-r--r-- | ios/app/AppDelegate.mm | 97 |
1 files changed, 10 insertions, 87 deletions
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 |