We've noticed the following crash with the SystemNavigationBar.:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.bridge.Callback.invoke(java.lang.Object[])' on a null object reference
at com.facebook.react.bridge.PromiseImpl.reject(PromiseImpl.java:231)
at com.facebook.react.bridge.PromiseImpl.reject(PromiseImpl.java:70)
at com.reactnativesystemnavigationbar.SystemNavigationBarModule.lambda$setSystemUIFlags$3$com-reactnativesystemnavigationbar-SystemNavigationBarModule(SystemNavigationBarModule.java:265)
at com.reactnativesystemnavigationbar.SystemNavigationBarModule$$ExternalSyntheticLambda1.run(:6)
We've noticed the following crash with the SystemNavigationBar.:
It seems like inside https://github.com/kadiraydinli/react-native-system-navigation-bar/blob/master/android/src/main/java/com/reactnativesystemnavigationbar/SystemNavigationBarModule.java#L254 a
Promise.resolve(true)
is always called but also apromise.reject("Error: ", "current activity is null");
is possible.Internally react-native will reset the
reject
/resolve
callback, https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java#L54 So we assume a race condition could cause this issue while inside thereject
-function. (At the start the reject-function will check for null, https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java#L173)We will create a pull request with a fix.
Kind regards, Roel