Skip to content

Commit 1bd66d9

Browse files
sherginfacebook-github-bot
authored andcommitted
RCTSurface: Calling start is now required to start the Surface
Summary: So, it does not start itself automatically right after instantiation. (Classic RCTSurface still kinda start itself automatically but only because start/stop concept is not implemented for this yet.) Reviewed By: sahrens Differential Revision: D13461294 fbshipit-source-id: 05430688f69a0d9bf75d03e6d25f02ccd5d3176a
1 parent d8fcb7f commit 1bd66d9

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ + (instancetype)newWithBridge:(RCTBridge *)bridge
3838
moduleName:moduleName
3939
initialProperties:properties];
4040

41+
[surface start];
42+
4143
state = [RCTSurfaceBackedComponentState newWithSurface:surface];
4244

4345
CKComponentScope::replaceState(scope, state);

React/Base/Surface/RCTSurface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
118118

119119
/**
120120
* Starts or stops the Surface.
121-
* Those methods are not implemented yet for regular RCTSurface.
121+
* Those methods are a no-op for regular RCTSurface (for now), but all call sites must call them appropriately.
122122
*/
123123
- (BOOL)start;
124124
- (BOOL)stop;

React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
4343
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
4444
{
4545
RCTSurface *surface = [[self class] createSurfaceWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
46+
[surface start];
4647
return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
4748
}
4849

React/Fabric/Surface/RCTFabricSurface.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ - (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
5555
_touchHandler = [RCTSurfaceTouchHandler new];
5656

5757
_stage = RCTSurfaceStageSurfaceDidInitialize;
58-
59-
[self start];
6058
}
6159

6260
return self;

React/Fabric/Surface/RCTFabricSurfaceHostingView.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#import "RCTFabricSurfaceHostingView.h"
99

10+
#import <React/RCTSurface.h>
1011
#import "RCTFabricSurface.h"
1112

1213
@implementation RCTFabricSurfaceHostingView
@@ -19,6 +20,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
1920
RCTSurface *surface = (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge
2021
moduleName:moduleName
2122
initialProperties:initialProperties];
23+
[surface start];
2224
return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
2325
}
2426

0 commit comments

Comments
 (0)