Skip to content

Commit

Permalink
Make surface presenter manage start of surface (#24372)
Browse files Browse the repository at this point in the history
Summary:
1. Start surface when first run, before, when we first load js bundle, `_startAllSurfaces` would not be called because `bridge == _batchedBridge`.
2. I think this fixes #23910, so I add the `return` in swizzle method to check.

cc shergin.

## Changelog

[iOS] [Fixed] - Make surface presenter manage start of surface
Pull Request resolved: #24372

Test Plan: N/A.

Differential Revision: D17337865

Pulled By: shergin

fbshipit-source-id: 2a1e413c006cae74ef6ca4c2b6b5ee8a46434b7f
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Sep 12, 2019
1 parent 791d097 commit 607e258
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
6 changes: 1 addition & 5 deletions React/Fabric/RCTSurfacePresenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ NS_ASSUME_NONNULL_BEGIN
* Surface uses these methods to register itself in the Presenter.
*/
- (void)registerSurface:(RCTFabricSurface *)surface;
/**
* Starting initiates running, rendering and mounting processes.
* Should be called after registerSurface and any other surface-specific setup is done
*/
- (void)startSurface:(RCTFabricSurface *)surface;
- (void)unregisterSurface:(RCTFabricSurface *)surface;

- (void)setProps:(NSDictionary *)props surface:(RCTFabricSurface *)surface;

- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
Expand Down
4 changes: 0 additions & 4 deletions React/Fabric/RCTSurfacePresenter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ - (RCTComponentViewFactory *)componentViewFactory
- (void)registerSurface:(RCTFabricSurface *)surface
{
[_surfaceRegistry registerSurface:surface];
}

- (void)startSurface:(RCTFabricSurface *)surface
{
[self _startSurface:surface];
}

Expand Down
5 changes: 1 addition & 4 deletions React/Fabric/Surface/RCTFabricSurface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ - (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
_touchHandler = [RCTSurfaceTouchHandler new];

_stage = RCTSurfaceStageSurfaceDidInitialize;

[_surfacePresenter registerSurface:self];
}

return self;
Expand All @@ -67,8 +65,7 @@ - (BOOL)start
if (![self _setStage:RCTSurfaceStageStarted]) {
return NO;
}

[_surfacePresenter startSurface:self];
[_surfacePresenter registerSurface:self];

return YES;
}
Expand Down

0 comments on commit 607e258

Please sign in to comment.