diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index eeb4a8022f0cd0..12f5947329379b 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -17,7 +17,6 @@ #import #import #import -#import #import #import #import diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm index f5c510794200a7..5b90e3618bd5f0 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm @@ -20,7 +20,8 @@ #import // Fabric -#import +#import +#import #import #import #endif @@ -68,9 +69,10 @@ void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled) { #if RCT_NEW_ARCH_ENABLED if (fabricEnabled) { - return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:bridge - moduleName:moduleName - initialProperties:initialProperties]; + id surface = [[RCTFabricSurface alloc] initWithBridge:bridge + moduleName:moduleName + initialProperties:initialProperties]; + return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface]; } #endif return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; diff --git a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h index bb5a574e2ee1f5..f36af0ee7b3350 100644 --- a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +++ b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h @@ -58,6 +58,8 @@ NS_ASSUME_NONNULL_BEGIN sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode moduleRegistry:(RCTModuleRegistry *)moduleRegistry; +- (instancetype)initWithSurface:(id)surface; + - (void)cancelTouches; @end diff --git a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm index 91ead4e7492774..a7c67cffcc68c5 100644 --- a/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +++ b/packages/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm @@ -104,6 +104,15 @@ - (instancetype)initWithSurface:(id)surface return self; } +- (instancetype)initWithSurface:(id)surface +{ + if (self = [super initWithSurface:surface + sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact]) { + [surface start]; + } + return self; +} + - (BOOL)hasBridge { return _bridge != nil; diff --git a/packages/react-native/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h b/packages/react-native/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h deleted file mode 100644 index c50144a8ee4f56..00000000000000 --- a/packages/react-native/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * Fabric-compatible RCTSurfaceHostingProxyRootView implementation. - */ -@interface RCTFabricSurfaceHostingProxyRootView : RCTSurfaceHostingProxyRootView - -@end diff --git a/packages/react-native/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm b/packages/react-native/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm deleted file mode 100644 index 5c399d8a33fcf9..00000000000000 --- a/packages/react-native/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFabricSurfaceHostingProxyRootView.h" - -#import "RCTFabricSurface.h" - -@implementation RCTFabricSurfaceHostingProxyRootView - -+ (id)createSurfaceWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - return [[RCTFabricSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; -} - -@end