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:
parent
ec884890b1
commit
cade297971
|
@ -186,6 +186,10 @@
|
||||||
{
|
{
|
||||||
RCTAssertMainQueue();
|
RCTAssertMainQueue();
|
||||||
|
|
||||||
|
// Reset states because the bridge is reloading. This is similar to initialization phase.
|
||||||
|
_stage = RCTSurfaceStageSurfaceDidInitialize;
|
||||||
|
_view = nil;
|
||||||
|
_touchHandler = nil;
|
||||||
[self _setStage:RCTSurfaceStageBridgeDidLoad];
|
[self _setStage:RCTSurfaceStageBridgeDidLoad];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue