We hold the currentActivity (resume->pause) so we know when we need to destroy the javascript context (when currentActivity is null, ie pause and destroy was called without resume).
If an activity start immediately after NavigationActivity, the NavigationActivity's onResume will not called, and the last NavigationActivity's onDestroy will destroy the Js instance, which is unexpected.
Override clearHostOnActivityDestroy in your MainApplication.
@Override
public boolean clearHostOnActivityDestroy() {
return false;
}
You'll also need to modify your startup code a bit as described here https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=compatibility-with-headlessjs
Has this changed in master. I can't seem to find clearHostOnActivityDestroy anywhere in the repo on the latest version. If so, has it moved or been replaced? Thanks!
Most helpful comment
Override
clearHostOnActivityDestroyin your MainApplication.You'll also need to modify your startup code a bit as described here https://wix.github.io/react-native-navigation/#/android-specific-use-cases?id=compatibility-with-headlessjs