Skip to content

Commit 53858ce

Browse files
Peter Arganyfacebook-github-bot
Peter Argany
authored andcommitted
Add reset method to RCTFabricSurface [2/N]
Summary: This method allows a surface to re-render from scratch, without having to delete and reinstantiate the surface. Changelog: [iOS] Added reset method to RCTFabricSurface to help with reloads Reviewed By: RSNara Differential Revision: D25000509 fbshipit-source-id: f74170aa78cc84491ad2679f130ed3c8965bbe34
1 parent 3a0ed2e commit 53858ce

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

React/Fabric/Surface/RCTFabricSurface.h

+7
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ NS_ASSUME_NONNULL_BEGIN
7070
- (BOOL)start;
7171
- (BOOL)stop;
7272

73+
/**
74+
* EXPERIMENTAL
75+
* Reset's the Surface to it's initial stage.
76+
* It uses the passed in surface presenter, and whatever else was passed in init.
77+
*/
78+
- (void)resetWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter;
79+
7380
#pragma mark - Layout: Setting the size constrains
7481

7582
/**

React/Fabric/Surface/RCTFabricSurface.mm

+7
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ - (instancetype)initWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
6464
return self;
6565
}
6666

67+
- (void)resetWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
68+
{
69+
_surfacePresenter = surfacePresenter;
70+
_stage = RCTSurfaceStageSurfaceDidInitialize;
71+
_view = nil;
72+
}
73+
6774
- (BOOL)start
6875
{
6976
if (![self _setStage:RCTSurfaceStageStarted]) {

0 commit comments

Comments
 (0)