You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
978 B

3 years ago
/**
* @format
*/
import { Alert, AppRegistry } from 'react-native'
import App from './src/App'
import { name as appName } from './app.json'
import { gestureHandlerRootHOC } from 'react-native-gesture-handler'
3 years ago
import {
setJSExceptionHandler,
setNativeExceptionHandler,
} from 'react-native-exception-handler'
import '@/services/system/skeleton-data.service'
const errorHandler = (e, isFatal) => {
if (isFatal) {
Alert.alert(
'Unexpected error occurred',
`
Error: ${isFatal ? 'Fatal:' : ''} ${e.name} ${e.message}
We will need to restart the app.
`,
[
{
text: 'Restart',
onPress: () => {},
},
],
)
} else {
console.log(e) // So that we can see it in the ADB logs in case of Android if needed
}
}
setJSExceptionHandler(errorHandler)
setNativeExceptionHandler(errorString => {
Alert.alert(JSON.stringify(errorString))
})
AppRegistry.registerComponent(appName, () => gestureHandlerRootHOC(App))