Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit dba150d

Browse files
committed
Add BEFORE_RESUME as an acceptable Lifecycle State to keep the instance manager alive.
1 parent 9735633 commit dba150d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

android/src/main/java/com/hudl/oss/react/fragment/ReactFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ public void onDestroy() {
135135
// onDestroy may be called on a ReactFragment after another ReactFragment has been
136136
// created and resumed with the same React Instance Manager. Make sure we only clean up
137137
// host's React Instance Manager if no other React Fragment is actively using it.
138-
if (reactInstanceMgr.getLifecycleState() != LifecycleState.RESUMED) {
138+
if (reactInstanceMgr.getLifecycleState() != LifecycleState.RESUMED
139+
&& reactInstanceMgr.getLifecycleState() != LifecycleState.BEFORE_RESUME) {
139140
reactInstanceMgr.onHostDestroy(getActivity());
140141
getReactNativeHost().clear();
141142
}

0 commit comments

Comments
 (0)