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
This commit is contained in:
Valentin Shergin
2018-12-18 12:26:53 -08:00
committed by Facebook Github Bot
parent d8fcb7f165
commit 1bd66d9aa9
5 changed files with 6 additions and 3 deletions

View File

@@ -38,6 +38,8 @@
moduleName:moduleName
initialProperties:properties];
[surface start];
state = [RCTSurfaceBackedComponentState newWithSurface:surface];
CKComponentScope::replaceState(scope, state);

View File

@@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Starts or stops the Surface.
* Those methods are not implemented yet for regular RCTSurface.
* Those methods are a no-op for regular RCTSurface (for now), but all call sites must call them appropriately.
*/
- (BOOL)start;
- (BOOL)stop;

View File

@@ -43,6 +43,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder)
sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode
{
RCTSurface *surface = [[self class] createSurfaceWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
[surface start];
return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
}

View File

@@ -55,8 +55,6 @@
_touchHandler = [RCTSurfaceTouchHandler new];
_stage = RCTSurfaceStageSurfaceDidInitialize;
[self start];
}
return self;

View File

@@ -7,6 +7,7 @@
#import "RCTFabricSurfaceHostingView.h"
#import <React/RCTSurface.h>
#import "RCTFabricSurface.h"
@implementation RCTFabricSurfaceHostingView
@@ -19,6 +20,7 @@
RCTSurface *surface = (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
[surface start];
return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
}