diff --git a/lib/ios/RNNAppDelegate.mm b/lib/ios/RNNAppDelegate.mm index 0f09eede4f0..7d94e3254e1 100644 --- a/lib/ios/RNNAppDelegate.mm +++ b/lib/ios/RNNAppDelegate.mm @@ -2,7 +2,7 @@ #import "RNNAppDelegate.h" #import -#ifdef RCT_NEW_ARCH_ENABLED + #import "RCTAppSetupUtils.h" #import #import @@ -23,11 +23,9 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot"; -@interface RNNAppDelegate () {} +@interface RNNAppDelegate () {} @end -#endif - @implementation RNNAppDelegate - (BOOL)application:(UIApplication *)application @@ -36,26 +34,16 @@ - (BOOL)application:(UIApplication *)application // Copied from RCTAppDelegate, it private inside it self.rootViewFactory = [self createRCTRootViewFactory]; -#ifdef RCT_NEW_ARCH_ENABLED - RCTAppSetupPrepareApp(application, self.turboModuleEnabled); + RCTAppSetupPrepareApp(application, self.newArchEnabled); RCTSetNewArchEnabled(TRUE); + RCTEnableTurboModuleInterop(YES); + RCTEnableTurboModuleInteropBridgeProxy(YES); + self.rootViewFactory.reactHost = [self.rootViewFactory createReactHost:launchOptions]; - if (self.bridgelessEnabled) { - // Creating host instead of bridge - self.rootViewFactory.reactHost = [self.rootViewFactory createReactHost:launchOptions]; - - [ReactNativeNavigation bootstrapWithHost:self.rootViewFactory.reactHost]; - - return YES; - } -#endif - // Force RN to init all necessary modules instead of copy-pasting code (ex. bridge) - [self.rootViewFactory viewWithModuleName:@""]; + [ReactNativeNavigation bootstrapWithHost:self.rootViewFactory.reactHost]; - [ReactNativeNavigation bootstrapWithBridge:self.bridge]; - - return YES; + return YES; } - (RCTRootViewFactory *)createRCTRootViewFactory @@ -68,31 +56,9 @@ - (RCTRootViewFactory *)createRCTRootViewFactory RCTRootViewFactoryConfiguration *configuration = [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock - newArchEnabled:self.fabricEnabled - turboModuleEnabled:self.turboModuleEnabled - bridgelessEnabled:self.bridgelessEnabled]; - - if (!self.bridgelessEnabled) { - configuration.extraModulesForBridge = ^NSArray> * _Nonnull(RCTBridge * _Nonnull bridge) { - return [ReactNativeNavigation extraModulesForBridge:bridge]; - }; - } - - configuration.createRootViewWithBridge = ^UIView *(RCTBridge *bridge, NSString *moduleName, NSDictionary *initProps) - { - // Ignoring creation of default view, will initialize our custom UIViewController later - return nil; - }; + newArchEnabled:self.newArchEnabled]; - configuration.createBridgeWithDelegate = ^RCTBridge *(id delegate, NSDictionary *launchOptions) - { - return [weakSelf createBridgeWithDelegate:delegate launchOptions:launchOptions]; - }; -#ifndef RCT_NEW_ARCH_ENABLED - return [[RCTRootViewFactory alloc] initWithConfiguration:configuration]; - } -#else return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self]; } @@ -117,7 +83,6 @@ - (Class)getModuleClassFromName:(const char *)name { - (id)getModuleInstanceFromClass:(Class)moduleClass { return RCTAppSetupDefaultModuleFromClass(moduleClass, self.dependencyProvider); } -#endif - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"