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
This commit is contained in:
Peter Argany
2020-11-17 14:50:18 -08:00
committed by Facebook GitHub Bot
parent 3a0ed2e551
commit 53858ceaa3
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -70,6 +70,13 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)start;
- (BOOL)stop;
/**
* EXPERIMENTAL
* Reset's the Surface to it's initial stage.
* It uses the passed in surface presenter, and whatever else was passed in init.
*/
- (void)resetWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter;
#pragma mark - Layout: Setting the size constrains
/**
+7
View File
@@ -64,6 +64,13 @@ using namespace facebook::react;
return self;
}
- (void)resetWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter
{
_surfacePresenter = surfacePresenter;
_stage = RCTSurfaceStageSurfaceDidInitialize;
_view = nil;
}
- (BOOL)start
{
if (![self _setStage:RCTSurfaceStageStarted]) {