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

Commit a2c81e1

Browse files
authored
Merge pull request #12 from hudl/DestroyHostIfNotUsed
Don't call destroy host if instance mgr actively used
2 parents eccf892 + 1afd925 commit a2c81e1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ allprojects {
1414
}
1515
1616
dependencies {
17-
// Version will correspond to its dependnecy on React Native
18-
compile 'com.github.hudl:react-native-android-fragment:v0.43.2'
17+
// Version will correspond to its dependency on React Native
18+
compile 'com.github.hudl:react-native-android-fragment:v0.46.2.2'
1919
}
2020
```
2121

@@ -25,7 +25,7 @@ Or Maven:
2525
<dependency>
2626
<groupId>com.hudl.oss</groupId>
2727
<artifactId>react-native-android-fragment</artifactId>
28-
<version>0.43.2</version>
28+
<version>0.46.2.2</version>
2929
</dependency>
3030
```
3131

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

3-
def libraryVersion = '0.43.2'
3+
def libraryVersion = '0.46.2.2'
44

55
buildscript {
66
repositories {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ public void onDestroy() {
155155
}
156156
if (getReactNativeHost().hasInstance()) {
157157
ReactInstanceManager reactInstanceMgr = getReactNativeHost().getReactInstanceManager();
158-
reactInstanceMgr.onHostDestroy(getActivity());
159158

160159
// onDestroy may be called on a ReactFragment after another ReactFragment has been
161160
// created and resumed with the same React Instance Manager. Make sure we only clean up
162161
// host's React Instance Manager if no other React Fragment is actively using it.
163162
if (reactInstanceMgr.getLifecycleState() != LifecycleState.RESUMED) {
163+
reactInstanceMgr.onHostDestroy(getActivity());
164164
getReactNativeHost().clear();
165165
}
166166
}

0 commit comments

Comments
 (0)