react-native-exception-handler icon indicating copy to clipboard operation
react-native-exception-handler copied to clipboard

Is it possible to restart the application from the modal?

Open guybridge opened this issue 3 years ago • 0 comments
trafficstars

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() }, }, ] ) }

guybridge avatar Jun 29 '22 11:06 guybridge