function showExceptionModal(error) { Alert.alert( "Oops...", "It looks like something went wrong and we will need to restart the app.", [ { text: "Restart", onPress: () => { RNRestart.Restart() }, }, { text: "Logout", onPress: () => { AsyncStorage.setItem(REFRESH_TOKEN, "") RNRestart.Restart() }, }, ] ) }
Trying to use in conjunction with react-native-restart however once the app has crashed. None of the buttons work.
setJSExceptionHandler((error, isFatal) => { jsExceptionHandler(error, isFatal) })
function jsExceptionHandler(error, isFatal = true) { const msg = access(error, "message") ||
Unknown Error: ${JSON.stringify(error, Object.getOwnPropertyNames(error))}if (isFatal) { showExceptionModal(msg) } }
function showExceptionModal(error) { Alert.alert( "Oops...", "It looks like something went wrong and we will need to restart the app.", [ { text: "Restart", onPress: () => { RNRestart.Restart() }, }, { text: "Logout", onPress: () => { AsyncStorage.setItem(REFRESH_TOKEN, "") RNRestart.Restart() }, }, ] ) }