@@ -17,9 +17,11 @@ import { useNetworkConnection } from '@open-webui-react-native/shared/features/n
1717import { constants } from '@open-webui-react-native/shared/utils/config' ;
1818import { setupReactotron } from '@open-webui-react-native/shared/utils/reactotron' ;
1919import { setLanguage } from '@ronas-it/react-native-common-modules/i18n' ;
20+ import * as Sentry from '@sentry/react-native' ;
2021import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client' ;
22+ import Constants from 'expo-constants' ;
2123import { useFonts } from 'expo-font' ;
22- import { SplashScreen , Stack } from 'expo-router' ;
24+ import { SplashScreen , Stack , useNavigationContainerRef } from 'expo-router' ;
2325import { ReactElement , useEffect } from 'react' ;
2426import { GestureHandlerRootView } from 'react-native-gesture-handler' ;
2527import { KeyboardProvider } from 'react-native-keyboard-controller' ;
@@ -29,6 +31,16 @@ import 'expo-dev-client';
2931
3032export { ErrorBoundary } from 'expo-router' ;
3133
34+ const reactNavigationIntegration = Sentry . reactNavigationIntegration ( ) ;
35+
36+ Sentry . init ( {
37+ dsn : Constants . expoConfig ?. extra ?. sentry ?. dsn ,
38+ environment : Constants . expoConfig ?. extra ?. env ,
39+ debug : false ,
40+ integrations : [ reactNavigationIntegration ] ,
41+ enabled : ! __DEV__ ,
42+ } ) ;
43+
3244const translations = {
3345 [ constants . defaultLocale ] : {
3446 ...require ( 'i18n/mobile/app/en.json' ) ,
@@ -85,9 +97,16 @@ function App(): ReactElement | null {
8597 ) ;
8698}
8799
88- export default function RootLayout ( ) : ReactElement | null {
100+ function RootLayout ( ) : ReactElement | null {
89101 useLanguage ( constants . defaultLocale ) ;
90102 const [ isFontsLoaded ] = useFonts ( fonts ) ;
103+ const navigationContainerRef = useNavigationContainerRef ( ) ;
104+
105+ useEffect ( ( ) => {
106+ if ( navigationContainerRef ) {
107+ reactNavigationIntegration . registerNavigationContainer ( navigationContainerRef ) ;
108+ }
109+ } , [ navigationContainerRef ] ) ;
91110
92111 useEffect ( ( ) => {
93112 if ( isFontsLoaded ) {
@@ -121,3 +140,5 @@ export default function RootLayout(): ReactElement | null {
121140 </ KeyboardProvider >
122141 ) ;
123142}
143+
144+ export default Sentry . wrap ( RootLayout ) ;
0 commit comments