@@ -73,9 +73,9 @@ - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
7373{
7474 if (self = [super init ]) {
7575 _bundleURLBlock = bundleURLBlock;
76- _fabricEnabled = newArchEnabled ;
77- _turboModuleEnabled = turboModuleEnabled ;
78- _bridgelessEnabled = bridgelessEnabled ;
76+ _fabricEnabled = YES ;
77+ _turboModuleEnabled = YES ;
78+ _bridgelessEnabled = YES ;
7979 }
8080 return self;
8181}
@@ -135,17 +135,12 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
135135
136136- (void )initializeReactHostWithLaunchOptions : (NSDictionary *)launchOptions
137137{
138- if (_configuration.bridgelessEnabled ) {
139- // Enable TurboModule interop by default in Bridgeless mode
140- RCTEnableTurboModuleInterop (YES );
141- RCTEnableTurboModuleInteropBridgeProxy (YES );
138+ // Enable TurboModule interop by default in Bridgeless mode
139+ RCTEnableTurboModuleInterop (YES );
140+ RCTEnableTurboModuleInteropBridgeProxy (YES );
142141
143- [self createReactHostIfNeeded: launchOptions];
144- return ;
145- }
146-
147- [self createBridgeIfNeeded: launchOptions];
148- [self createBridgeAdapterIfNeeded ];
142+ [self createReactHostIfNeeded: launchOptions];
143+ return ;
149144}
150145
151146- (UIView *)viewWithModuleName : (NSString *)moduleName
@@ -154,29 +149,17 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
154149{
155150 [self initializeReactHostWithLaunchOptions: launchOptions];
156151
157- if (_configuration. bridgelessEnabled ) {
158- RCTFabricSurface *surface = [ self .reactHost createSurfaceWithModuleName: moduleName initialProperties: initProps];
152+ RCTFabricSurface *surface = [ self .reactHost createSurfaceWithModuleName: moduleName
153+ initialProperties: initProps ? initProps : @{} ];
159154
160- RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView =
161- [[RCTSurfaceHostingProxyRootView alloc ] initWithSurface: surface];
155+ RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView =
156+ [[RCTSurfaceHostingProxyRootView alloc ] initWithSurface: surface];
162157
163- surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor ];
164- if (_configuration.customizeRootView != nil ) {
165- _configuration.customizeRootView (surfaceHostingProxyRootView);
166- }
167- return surfaceHostingProxyRootView;
168- }
169-
170- UIView *rootView;
171- if (_configuration.createRootViewWithBridge != nil ) {
172- rootView = _configuration.createRootViewWithBridge (self.bridge , moduleName, initProps);
173- } else {
174- rootView = [self createRootViewWithBridge: self .bridge moduleName: moduleName initProps: initProps];
175- }
158+ surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor ];
176159 if (_configuration.customizeRootView != nil ) {
177- _configuration.customizeRootView (rootView );
160+ _configuration.customizeRootView (surfaceHostingProxyRootView );
178161 }
179- return rootView ;
162+ return surfaceHostingProxyRootView ;
180163}
181164
182165- (RCTBridge *)createBridgeWithDelegate : (id <RCTBridgeDelegate>)delegate launchOptions : (NSDictionary *)launchOptions
@@ -188,8 +171,7 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
188171 moduleName : (NSString *)moduleName
189172 initProps : (NSDictionary *)initProps
190173{
191- BOOL enableFabric = _configuration.fabricEnabled ;
192- UIView *rootView = RCTAppSetupDefaultRootView (bridge, moduleName, initProps, enableFabric);
174+ UIView *rootView = RCTAppSetupDefaultRootView (bridge, moduleName, initProps, YES );
193175 rootView.backgroundColor = [UIColor systemBackgroundColor ];
194176 return rootView;
195177}
@@ -198,19 +180,15 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
198180- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge : (RCTBridge *)bridge
199181{
200182 _runtimeScheduler = std::make_shared<facebook::react::RuntimeScheduler>(RCTRuntimeExecutorFromBridge (bridge));
201- if (RCTIsNewArchEnabled ()) {
202- std::shared_ptr<facebook::react::CallInvoker> callInvoker =
203- std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(_runtimeScheduler);
204- RCTTurboModuleManager *turboModuleManager =
205- [[RCTTurboModuleManager alloc ] initWithBridge: bridge
206- delegate: _turboModuleManagerDelegate
207- jsInvoker: callInvoker];
208- _contextContainer->erase (" RuntimeScheduler" );
209- _contextContainer->insert (" RuntimeScheduler" , _runtimeScheduler);
210- return RCTAppSetupDefaultJsExecutorFactory (bridge, turboModuleManager, _runtimeScheduler);
211- } else {
212- return RCTAppSetupJsExecutorFactoryForOldArch (bridge, _runtimeScheduler);
213- }
183+
184+ std::shared_ptr<facebook::react::CallInvoker> callInvoker =
185+ std::make_shared<facebook::react::RuntimeSchedulerCallInvoker>(_runtimeScheduler);
186+ RCTTurboModuleManager *turboModuleManager = [[RCTTurboModuleManager alloc ] initWithBridge: bridge
187+ delegate: _turboModuleManagerDelegate
188+ jsInvoker: callInvoker];
189+ _contextContainer->erase (" RuntimeScheduler" );
190+ _contextContainer->insert (" RuntimeScheduler" , _runtimeScheduler);
191+ return RCTAppSetupDefaultJsExecutorFactory (bridge, turboModuleManager, _runtimeScheduler);
214192}
215193
216194- (void )createBridgeIfNeeded : (NSDictionary *)launchOptions
@@ -228,7 +206,7 @@ - (void)createBridgeIfNeeded:(NSDictionary *)launchOptions
228206
229207- (void )createBridgeAdapterIfNeeded
230208{
231- if (! self-> _configuration . fabricEnabled || self. bridgeAdapter ) {
209+ if (self. bridgeAdapter != nullptr ) {
232210 return ;
233211 }
234212
0 commit comments