Skip to content

Commit

Permalink
Fix ReactInstanceManager unmountApplication
Browse files Browse the repository at this point in the history
Reviewed By: mdvacca

Differential Revision: D7945746

fbshipit-source-id: 0c2eed9a623e442fa4a4ff29ffa01f025466c9b6
  • Loading branch information
ayc1 authored and facebook-github-bot committed May 30, 2018
1 parent c6b4f9f commit 4a9b2a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ public void runGuarded() {
public void unmountReactApplication() {
if (mReactInstanceManager != null && mIsAttachedToInstance) {
mReactInstanceManager.detachRootView(this);
mReactInstanceManager = null;
mIsAttachedToInstance = false;
}
mShouldLogContentAppeared = false;
Expand Down
11 changes: 11 additions & 0 deletions ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,15 @@ public void testTouchEmitter() {
MotionEvent.obtain(50, new Date().getTime(), MotionEvent.ACTION_HOVER_MOVE, 0, 0, 0));
verifyNoMoreInteractions(eventDispatcher);
}

@Test
public void testRemountApplication() {
ReactInstanceManager instanceManager = mock(ReactInstanceManager.class);

ReactRootView rootView = new ReactRootView(mReactContext);

rootView.startReactApplication(instanceManager, "");
rootView.unmountReactApplication();
rootView.startReactApplication(instanceManager, "");
}
}

0 comments on commit 4a9b2a7

Please sign in to comment.