Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions samples/react-native/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as ImagePicker from 'react-native-image-picker';

import RunningIndicator from './components/RunningIndicator';
import WebviewScreen from './Screens/WebviewScreen';
import CrashScreen from './Screens/CrashScreen';
import getErrorsTab from './tabs/ErrorsTab';
import getPerformanceTab from './tabs/PerformanceTab';
import getPlaygroundTab from './tabs/PlaygroundTab';
Expand Down Expand Up @@ -249,6 +250,11 @@ function RootNavigationContainer() {
component={WebviewScreen}
options={{ headerShown: true }}
/>
<StackNavigator.Screen
name="CrashScreen"
component={CrashScreen}
options={{ headerShown: true }}
/>
</StackNavigator.Navigator>
</NavigationContainer>
);
Expand Down
25 changes: 25 additions & 0 deletions samples/react-native/src/Screens/CrashScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { View, Button } from 'react-native';

// Object with notAFunction property to demonstrate the crash
const testObject = {
notAFunction: "I'm not a function!",
};


function CrashScreen() {
// This will crash on screen load
testObject.notAFunction()

// The button never actually loads. Left here for testing purposes.
return (
<View>
<Button
title='Crash Now!'
onPress={() => testObject.notAFunction()}
/>
</View>
);
}

export default CrashScreen;
4 changes: 4 additions & 0 deletions samples/react-native/src/Screens/ErrorsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ const ErrorsScreen = (_props: Props) => {
Sentry.logger.info('info log with data', { database: 'admin', number: 123, obj: { password: 'admin' } });
}}
/>
<Button
title='Javascript Error on load'
onPress={() => _props.navigation.navigate('CrashScreen')}
/>
{Platform.OS === 'android' && (
<>
<Button
Expand Down
Loading