/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React from 'react'
import type {PropsWithChildren} from 'react'
import {
Button,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
Platform,
View,
} from 'react-native'
// Setup Bugsnag client to capture errors automatically
import Bugsnag from '@bugsnag/react-native'
Bugsnag.start()
const bogusObject = {} as any
function triggerException() {
bogusObject.bogusFunction()
}
function triggerHandledException() {
bogusObject.bogusHandledFunction()
}
async function triggerPromiseRejection() {
// try {
// await NativeModules.CrashyCrashy.generatePromiseRejection()
// } catch (e: any) {
// Bugsnag.notify(e)
// }
}
function triggerNativeException() {
// NativeModules.CrashyCrashy.generateCrash()
}
function triggerNativeHandledError() {
// NativeModules.CrashyCrashy.handledError()
}
type SectionProps = PropsWithChildren<{
title: string
}>
function App(): JSX.Element {
return (
<>
{global.HermesInternal == null ? null : (
Engine: Hermes ({global.__turboModuleProxy != null ? 'Turbo' : 'Native'} Modules)
)}
Press the buttons below to test examples of Bugsnag functionality. Make sure you have changed the API key in Info.plist or AndroidManifest.xml.
Tap this button to send a JS crash to Bugsnag
Tap this button to send a native {Platform.OS} crash to Bugsnag
>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#eeeeee',
},
buttonContainer: {
margin: 20
},
info: {
textAlign: 'center',
color: '#666',
fontSize: 11,
marginBottom: 20
}
})
export default App