Skip to content

Commit 4a9b2a7

Browse files
ayc1facebook-github-bot
authored andcommitted
Fix ReactInstanceManager unmountApplication
Reviewed By: mdvacca Differential Revision: D7945746 fbshipit-source-id: 0c2eed9a623e442fa4a4ff29ffa01f025466c9b6
1 parent c6b4f9f commit 4a9b2a7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java

+1
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ public void runGuarded() {
423423
public void unmountReactApplication() {
424424
if (mReactInstanceManager != null && mIsAttachedToInstance) {
425425
mReactInstanceManager.detachRootView(this);
426+
mReactInstanceManager = null;
426427
mIsAttachedToInstance = false;
427428
}
428429
mShouldLogContentAppeared = false;

ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java

+11
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,15 @@ public void testTouchEmitter() {
195195
MotionEvent.obtain(50, new Date().getTime(), MotionEvent.ACTION_HOVER_MOVE, 0, 0, 0));
196196
verifyNoMoreInteractions(eventDispatcher);
197197
}
198+
199+
@Test
200+
public void testRemountApplication() {
201+
ReactInstanceManager instanceManager = mock(ReactInstanceManager.class);
202+
203+
ReactRootView rootView = new ReactRootView(mReactContext);
204+
205+
rootView.startReactApplication(instanceManager, "");
206+
rootView.unmountReactApplication();
207+
rootView.startReactApplication(instanceManager, "");
208+
}
198209
}

0 commit comments

Comments
 (0)