a7ul / react-native-exception-handler

A react native module that lets you to register a global error handler that can capture fatal/non fatal uncaught exceptions.
MIT License
1.58k stars 133 forks source link

Not working in Samsung Galaxy S8 #115

Open jonatasnardi opened 5 years ago

jonatasnardi commented 5 years ago

Hello,

I implemented this lib in my app, and works fine on iOS and Android (Zenfone). It is showing the Alert as expected when the app crashes and show the white screen. But on Samsung Galaxy S8, when the app crashes, the white screen is not showing, and the app freezes and the Alert is not showing.

Here is my code in App.js:


const errorHandler = (e, isFatal) => {
    setTimeout(() => {
      showAlertExceptionRestart();  
    }, 0);
};

setJSExceptionHandler(errorHandler, true);

setNativeExceptionHandler(exceptionString => {
  errorHandler;
});

showAlertExceptionRestart = () => {
  Alert.alert(
    i18n.t('Generico.CrashTitulo'),
    i18n.t('Generico.CrashSubtitulo'),
    [{
      text: i18n.t('Generico.CrashReiniciar'),
      onPress: () => {
        RNRestart.Restart();
      }
    }]
  );
}

RN version: 0.58.1 react-native-exception-handler version: 2.10.8

Any idea to solve this?

90dy commented 5 years ago

Hello,

You cannot show an alert when a native exception occure

From README.md: