File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useEffect } from "react" ;
2- import { SafeAreaProvider } from "react-native-safe-area-context" ;
3- import * as Speech from "expo-speech" ;
4- import * as SplashScreen from "expo-splash-screen" ;
51import * as Sentry from "@sentry/react-native" ;
62import { addNotificationReceivedListener } from "expo-notifications/build/NotificationsEmitter" ;
3+ import * as Speech from "expo-speech" ;
4+ import * as SplashScreen from "expo-splash-screen" ;
5+ import { useEffect } from "react" ;
6+ import { SafeAreaProvider } from "react-native-safe-area-context" ;
77
88import ErrorBoundary from "./components/ErrorBoundary" ;
99import RootNavigator from "./navigation/RootNavigator" ;
@@ -12,10 +12,16 @@ import { AppStateProvider } from "./state/appState";
1212
1313SplashScreen . preventAutoHideAsync ( ) ;
1414
15- Sentry . init ( {
16- dsn : "__YOUR_SENTRY_DSN__" ,
17- enabled : ! __DEV__ ,
18- } ) ;
15+ const sentryDsn = "__YOUR_SENTRY_DSN__" . trim ( ) ;
16+ const isValidSentryDsn = / ^ h t t p s ? : \/ \/ .+ / . test ( sentryDsn ) ;
17+ const isSentryEnabled = ! __DEV__ && isValidSentryDsn ;
18+
19+ if ( isSentryEnabled ) {
20+ Sentry . init ( {
21+ dsn : sentryDsn ,
22+ enabled : true ,
23+ } ) ;
24+ }
1925
2026function AppInner ( ) {
2127 useEffect ( ( ) => {
@@ -51,10 +57,12 @@ function AppInner() {
5157 ) ;
5258}
5359
54- export default Sentry . wrap ( function App ( ) {
60+ function App ( ) {
5561 return (
5662 < ErrorBoundary >
5763 < AppInner />
5864 </ ErrorBoundary >
5965 ) ;
60- } ) ;
66+ }
67+
68+ export default isSentryEnabled ? Sentry . wrap ( App ) : App ;
You can’t perform that action at this time.
0 commit comments