mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
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:
committed by
Facebook Github Bot
parent
d8fcb7f165
commit
1bd66d9aa9
@@ -38,6 +38,8 @@
|
||||
moduleName:moduleName
|
||||
initialProperties:properties];
|
||||
|
||||
[surface start];
|
||||
|
||||
state = [RCTSurfaceBackedComponentState newWithSurface:surface];
|
||||
|
||||
CKComponentScope::replaceState(scope, state);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@
|
||||
_touchHandler = [RCTSurfaceTouchHandler new];
|
||||
|
||||
_stage = RCTSurfaceStageSurfaceDidInitialize;
|
||||
|
||||
[self start];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user