@@ -105,48 +105,46 @@ - (void)applicationDidEnterBackground:(UIApplication *)application
105105}
106106
107107- (UIView *)viewWithModuleName : (NSString *)moduleName initialProperties : (NSDictionary *)initialProperties launchOptions : (NSDictionary *)launchOptions {
108- BOOL fabricEnabled = self.fabricEnabled ;
109- BOOL enableBridgeless = self.bridgelessEnabled ;
110-
111- NSDictionary *initProps = updateInitialProps (initialProperties, fabricEnabled);
108+ BOOL fabricEnabled = self.fabricEnabled ;
109+ BOOL enableBridgeless = self.bridgelessEnabled ;
110+
111+ NSDictionary *initProps = updateInitialProps (initialProperties, fabricEnabled);
112+
113+ UIView *rootView;
114+ if (enableBridgeless) {
115+ // Enable native view config interop only if both bridgeless mode and Fabric is enabled.
116+ RCTSetUseNativeViewConfigsInBridgelessMode (self.fabricEnabled );
117+
118+ // Enable TurboModule interop by default in Bridgeless mode
119+ RCTEnableTurboModuleInterop (YES );
120+ RCTEnableTurboModuleInteropBridgeProxy (YES );
121+
122+ [self createReactHost ];
123+ [RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider = self;
124+ RCTFabricSurface *surface = [_reactHost createSurfaceWithModuleName: self .moduleName initialProperties: initProps];
125+
126+ RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView = [[RCTSurfaceHostingProxyRootView alloc ]
127+ initWithSurface: surface
128+ sizeMeasureMode: RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];
112129
113- UIView *rootView;
114- if (enableBridgeless) {
115- // Enable native view config interop only if both bridgeless mode and Fabric is enabled.
116- RCTSetUseNativeViewConfigsInBridgelessMode (self.fabricEnabled );
117-
118- // Enable TurboModule interop by default in Bridgeless mode
119- RCTEnableTurboModuleInterop (YES );
120- RCTEnableTurboModuleInteropBridgeProxy (YES );
121-
122- [self createReactHost ];
123- [RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider = self;
124- RCTFabricSurface *surface = [_reactHost createSurfaceWithModuleName: self .moduleName initialProperties: initProps];
125-
126- RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView = [[RCTSurfaceHostingProxyRootView alloc ]
127- initWithSurface: surface
128- sizeMeasureMode: RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];
129-
130130 rootView = (RCTRootView *)surfaceHostingProxyRootView;
131131 rootView.backgroundColor = [UIColor systemBackgroundColor ];
132- } else {
133- if (!self.bridge ) {
134- self.bridge = [self createBridgeWithDelegate: self launchOptions: launchOptions];
135- }
136- if ([self newArchEnabled ]) {
137- self.bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc ] initWithBridge: self .bridge
138- contextContainer: _contextContainer];
139- self.bridge .surfacePresenter = self.bridgeAdapter .surfacePresenter ;
140-
141- [RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider = self;
142- }
143- }
144- rootView = [self createRootViewWithBridge: self .bridge moduleName: moduleName initProps: initProps];
145- }
146-
147- [self customizeRootView: (RCTRootView *)rootView];
132+ }
133+ if (!self.bridge ) {
134+ self.bridge = [self createBridgeWithDelegate: self launchOptions: launchOptions];
135+ }
136+ if ([self newArchEnabled ]) {
137+ self.bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc ] initWithBridge: self .bridge
138+ contextContainer: _contextContainer];
139+ self.bridge .surfacePresenter = self.bridgeAdapter .surfacePresenter ;
148140
149- return rootView;
141+ [RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider = self;
142+ }
143+ rootView = [self createRootViewWithBridge: self .bridge moduleName: moduleName initProps: initProps];
144+
145+ [self customizeRootView: (RCTRootView *)rootView];
146+
147+ return rootView;
150148}
151149
152150- (NSURL *)sourceURLForBridge : (RCTBridge *)bridge
0 commit comments