wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.01k stars 2.68k forks source link

Fix onHostPause crash on Android #7812

Closed yogevbd closed 7 months ago

yogevbd commented 8 months ago

This fixes a crash happening in the Wix app, look like there's a race condition where the activity is destroyed and navigator.onHostPause() gets called too late and should always be called at front of queue. Most of times this shouldn't be delayed as it is called on the main thread.

This is the crash:

Location
NavigationModule.java line 213 in com.reactnativenavigation.react.NavigationModule.navigator
Exception
java.lang.NullPointerException
Message
Attempt to invoke virtual method 'com.reactnativenavigation.viewcontrollers.navigator.Navigator com.reactnativenavigation.NavigationActivity.getNavigator()' on a null object reference
manuhook commented 7 months ago

Hi @yogevbd

Can we do the same for onHostResume please ?

Please see this patch : https://github.com/wix/react-native-navigation/issues/7593#issuecomment-1245475643

Thank you,