text: import {Alert} from 'react-native';
  import {BackAndroid} from 'react-native';
  import {setJSExceptionHandler} from 'react-native-exception-handler';
  
  const reporter = (error) => {
    // Logic for reporting to devs
    // Example : Log issues to github issues using github apis.
    console.log(error); // sample
  };
  
  const errorHandler = (e, isFatal) => {
    if (isFatal) {
      reporter(e);
      Alert.alert(
          'Unexpected error occurred',
          `
          Error: ${(isFatal) ? 'Fatal:' : ''} ${e.name} ${e.message}
  
          We have reported this to our team ! Please close the app and start again!
          `,
        [{
          text: 'Close',
          onPress: () => {
            BackAndroid.exitApp();
          }
        }]
      );
    } else {
      console.log(e); // So that we can see it in the ADB logs in case of Android if needed
    }
  };
  
  setJSExceptionHandler(errorHandler);
  