iOS Surface: properly reset some internal states when JS reloads

Summary:
There are a few important states that didn't reset correctly when reloading JS:
* the RCTSurfaceStage was stuck at all bits enabled, hence no further stage change happened (even though the state "reset" to `RCTSurfaceStageBridgeDidLoad`)
* the RCTSurfaceView didn't get recreated, because the _view ivar was never cleared
* similarly, the _touchHandler ivar attached to the _view was never re-setup --> all touches after JS reload were dropped before this diff

Reviewed By: mmmulani

Differential Revision: D7178038

fbshipit-source-id: ba49bc205f8bf43842471b7ab748cef8549ea212
This commit is contained in:
Kevin Gozali 2018-03-07 10:20:52 -08:00 committed by Facebook Github Bot
parent ec884890b1
commit cade297971
1 changed files with 4 additions and 0 deletions

View File

@ -186,6 +186,10 @@
{
RCTAssertMainQueue();
// Reset states because the bridge is reloading. This is similar to initialization phase.
_stage = RCTSurfaceStageSurfaceDidInitialize;
_view = nil;
_touchHandler = nil;
[self _setStage:RCTSurfaceStageBridgeDidLoad];
}