Migrate surface view off RCTSurface (#51328)

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

RCTSurface is a legacy class. We might be able to kill it off.

Let's decouple RCTSurfaceView from RCTSurface.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D72582309

fbshipit-source-id: 0ffb6c2d08c5ee1eda6ae90955ccbc14f57036b7
This commit is contained in:
Ramanpreet Nara
2025-05-14 13:10:41 -07:00
committed by Facebook GitHub Bot
parent 70eeb9f541
commit e275da45ea
3 changed files with 5 additions and 5 deletions
@@ -9,16 +9,16 @@
NS_ASSUME_NONNULL_BEGIN
@class RCTSurface;
@protocol RCTSurfaceProtocol;
/**
* UIView instance which represents the Surface
*/
@interface RCTSurfaceView : UIView
- (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface NS_DESIGNATED_INITIALIZER;
@property (nonatomic, weak, readonly, nullable) RCTSurface *surface;
@property (nonatomic, weak, readonly, nullable) id<RCTSurfaceProtocol> surface;
@end
@@ -21,7 +21,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
- (instancetype)initWithSurface:(RCTSurface *)surface
- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
{
if (self = [super initWithFrame:CGRectZero]) {
_stage = surface.stage;
@@ -142,7 +142,7 @@ using namespace facebook::react;
RCTAssertMainQueue();
if (!_view) {
_view = [[RCTSurfaceView alloc] initWithSurface:(RCTSurface *)self];
_view = [[RCTSurfaceView alloc] initWithSurface:self];
[self _updateLayoutContext];
_touchHandler = [RCTSurfaceTouchHandler new];
[_touchHandler attachToView:_view];