22#import " RNNAppDelegate.h"
33#import < ReactNativeNavigation/ReactNativeNavigation.h>
44
5- # ifdef RCT_NEW_ARCH_ENABLED
5+
66#import " RCTAppSetupUtils.h"
77#import < React/CoreModulesPlugins.h>
88#import < React/RCTCxxBridgeDelegate.h>
2323
2424static NSString *const kRNConcurrentRoot = @" concurrentRoot" ;
2525
26- @interface RNNAppDelegate () <RCTTurboModuleManagerDelegate, RCTCxxBridgeDelegate > {}
26+ @interface RNNAppDelegate () <RCTTurboModuleManagerDelegate> {}
2727@end
2828
29- #endif
30-
3129@implementation RNNAppDelegate
3230
3331- (BOOL )application : (UIApplication *)application
@@ -36,26 +34,16 @@ - (BOOL)application:(UIApplication *)application
3634 // Copied from RCTAppDelegate, it private inside it
3735 self.rootViewFactory = [self createRCTRootViewFactory ];
3836
39- #ifdef RCT_NEW_ARCH_ENABLED
40- RCTAppSetupPrepareApp (application, self.turboModuleEnabled );
37+ RCTAppSetupPrepareApp (application, self.newArchEnabled );
4138 RCTSetNewArchEnabled (TRUE );
39+ RCTEnableTurboModuleInterop (YES );
40+ RCTEnableTurboModuleInteropBridgeProxy (YES );
4241
42+ self.rootViewFactory .reactHost = [self .rootViewFactory createReactHost: launchOptions];
4343
44- if (self.bridgelessEnabled ) {
45- // Creating host instead of bridge
46- self.rootViewFactory .reactHost = [self .rootViewFactory createReactHost: launchOptions];
47-
48- [ReactNativeNavigation bootstrapWithHost: self .rootViewFactory.reactHost];
49-
50- return YES ;
51- }
52- #endif
53- // Force RN to init all necessary modules instead of copy-pasting code (ex. bridge)
54- [self .rootViewFactory viewWithModuleName: @" " ];
44+ [ReactNativeNavigation bootstrapWithHost: self .rootViewFactory.reactHost];
5545
56- [ReactNativeNavigation bootstrapWithBridge: self .bridge];
57-
58- return YES ;
46+ return YES ;
5947}
6048
6149- (RCTRootViewFactory *)createRCTRootViewFactory
@@ -68,31 +56,9 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
6856
6957 RCTRootViewFactoryConfiguration *configuration =
7058 [[RCTRootViewFactoryConfiguration alloc ] initWithBundleURLBlock: bundleUrlBlock
71- newArchEnabled: self .fabricEnabled
72- turboModuleEnabled: self .turboModuleEnabled
73- bridgelessEnabled: self .bridgelessEnabled];
74-
75- if (!self.bridgelessEnabled ) {
76- configuration.extraModulesForBridge = ^NSArray <id <RCTBridgeModule>> * _Nonnull (RCTBridge * _Nonnull bridge) {
77- return [ReactNativeNavigation extraModulesForBridge: bridge];
78- };
79- }
80-
81- configuration.createRootViewWithBridge = ^UIView *(RCTBridge *bridge, NSString *moduleName, NSDictionary *initProps)
82- {
83- // Ignoring creation of default view, will initialize our custom UIViewController later
84- return nil ;
85- };
59+ newArchEnabled: self .newArchEnabled];
8660
87- configuration.createBridgeWithDelegate = ^RCTBridge *(id <RCTBridgeDelegate> delegate, NSDictionary *launchOptions)
88- {
89- return [weakSelf createBridgeWithDelegate: delegate launchOptions: launchOptions];
90- };
9161
92- #ifndef RCT_NEW_ARCH_ENABLED
93- return [[RCTRootViewFactory alloc ] initWithConfiguration: configuration];
94- }
95- #else
9662 return [[RCTRootViewFactory alloc ] initWithConfiguration: configuration andTurboModuleManagerDelegate: self ];
9763}
9864
@@ -117,7 +83,6 @@ - (Class)getModuleClassFromName:(const char *)name {
11783- (id <RCTTurboModule>)getModuleInstanceFromClass : (Class )moduleClass {
11884 return RCTAppSetupDefaultModuleFromClass (moduleClass, self.dependencyProvider );
11985}
120- #endif
12186
12287- (NSURL *)sourceURLForBridge : (RCTBridge *)bridge {
12388 [NSException raise: @" RCTBridgeDelegate::sourceURLForBridge not implemented"
0 commit comments