Closed as not planned
Description
Description
Why am I installing an official sentry configuration and when I throw an exception, the exception is not properly monitored?
package.json
"dependencies": {
"@sentry/react-native": "^6.4.0",
"react": "18.3.1",
"react-native": "0.76.5"
},
And I just ran
npx @sentry/wizard@latest -s -i reactNative
My App.tsx
import * as Sentry from '@sentry/react-native';
Sentry.init({
dsn: 'https://08f8d9efe65a619d11956c6417b083b7@o4508367923642368.ingest.us.sentry.io/4508448313704448',
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// enableSpotlight: __DEV__,
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
});
type SectionProps = PropsWithChildren<{
title: string;
}>;
function Section({ children, title }: SectionProps): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
// I click this button , the sentry cannot work
<Button title='Sentry Try!' onPress={() => { Sentry.captureException(new Error('First error')); }} />
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
}
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
</Section>
<Section title="See Your Changes">
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
export default Sentry.wrap(App);
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done
Status
Waiting for: Community