kill RCTFabricSurfaceHostingProxyRootView (#38864)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38864

## Changelog:

[iOS][Breaking] - Deleting RCTFabricSurfaceHostingProxyRootView

We currently have 3 different container view classes in new architecture: `RCTFabricSurfaceHostingProxyRootView`, `RCTSurfaceHostingProxyRootView`, and `RCTSurfaceHostingView`. it's a little complicated for the current use case, so there's an opportunity to simplify.

in this PR, i get rid of `RCTFabricSurfaceHostingProxyRootView` by relying on the composable behavior of surface and host views instead of existing internal reflection logic that depends on inheritance. these are cleaned up in D48140101 and D48140317.

i checked GH search and no one is really using this in a fundamental way.

bypass-github-export-checks

Reviewed By: cipolleschi

Differential Revision: D48139820

fbshipit-source-id: 068b994a8b068a4107397f1862356b8fa1da961f
This commit is contained in:
Phillip Pan
2023-08-16 13:34:54 -07:00
committed by Facebook GitHub Bot
parent 02408e1df2
commit 676676c954
6 changed files with 17 additions and 41 deletions
@@ -17,7 +17,6 @@
#import <React/RCTComponentViewProtocol.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurface.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTLegacyViewManagerInteropComponentView.h>
#import <React/RCTSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
@@ -20,7 +20,8 @@
#import <React/RCTNetworking.h>
// Fabric
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTFabricSurface.h>
#import <React/RCTSurfaceHostingProxyRootView.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
#endif
@@ -68,9 +69,10 @@ RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary
{
#if RCT_NEW_ARCH_ENABLED
if (fabricEnabled) {
return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
id<RCTSurfaceProtocol> surface = [[RCTFabricSurface alloc] initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
}
#endif
return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
@@ -58,6 +58,8 @@ NS_ASSUME_NONNULL_BEGIN
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
moduleRegistry:(RCTModuleRegistry *)moduleRegistry;
- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface;
- (void)cancelTouches;
@end
@@ -104,6 +104,15 @@ static RCTRootViewSizeFlexibility convertToRootViewSizeFlexibility(RCTSurfaceSiz
return self;
}
- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
{
if (self = [super initWithSurface:surface
sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact]) {
[surface start];
}
return self;
}
- (BOOL)hasBridge
{
return _bridge != nil;
@@ -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 <React/RCTSurfaceHostingProxyRootView.h>
/**
* Fabric-compatible RCTSurfaceHostingProxyRootView implementation.
*/
@interface RCTFabricSurfaceHostingProxyRootView : RCTSurfaceHostingProxyRootView
@end
@@ -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<RCTSurfaceProtocol>)createSurfaceWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
{
return [[RCTFabricSurface alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
}
@end