@@ -4,12 +4,14 @@ import {
4
4
NavigationContainerRef ,
5
5
} from '@react-navigation/native' ;
6
6
import { createStackNavigator } from '@react-navigation/stack' ;
7
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' ;
7
8
8
9
// Import the Sentry React Native SDK
9
10
import * as Sentry from '@sentry/react-native' ;
10
11
11
12
import { SENTRY_INTERNAL_DSN } from './dsn' ;
12
- import HomeScreen from './Screens/HomeScreen' ;
13
+ import ErrorsScreen from './Screens/ErrorsScreen' ;
14
+ import PerformanceScreen from './Screens/PerformanceScreen' ;
13
15
import TrackerScreen from './Screens/TrackerScreen' ;
14
16
import ManualTrackerScreen from './Screens/ManualTrackerScreen' ;
15
17
import PerformanceTimingScreen from './Screens/PerformanceTimingScreen' ;
@@ -20,6 +22,7 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
20
22
import GesturesTracingScreen from './Screens/GesturesTracingScreen' ;
21
23
import { StyleSheet } from 'react-native' ;
22
24
import { HttpClient } from '@sentry/integrations' ;
25
+ import Ionicons from 'react-native-vector-icons/Ionicons' ;
23
26
24
27
const reactNavigationInstrumentation =
25
28
new Sentry . ReactNavigationInstrumentation ( {
@@ -98,44 +101,100 @@ Sentry.init({
98
101
} ) ;
99
102
100
103
const Stack = createStackNavigator ( ) ;
104
+ const Tab = createBottomTabNavigator ( ) ;
101
105
102
- const App = ( ) => {
103
- const navigation = React . useRef < NavigationContainerRef < { } > > ( null ) ;
106
+ const TabOneStack = ( ) => {
107
+ return (
108
+ < GestureHandlerRootView style = { styles . wrapper } >
109
+ < Provider store = { store } >
110
+ < Stack . Navigator >
111
+ < Stack . Screen
112
+ name = "ErrorsScreen"
113
+ component = { ErrorsScreen }
114
+ options = { { title : 'Errors' } }
115
+ />
116
+ </ Stack . Navigator >
117
+ </ Provider >
118
+ </ GestureHandlerRootView >
119
+ ) ;
120
+ } ;
104
121
122
+ const TabTwoStack = ( ) => {
105
123
return (
106
124
< GestureHandlerRootView style = { styles . wrapper } >
107
125
< Provider store = { store } >
108
- < NavigationContainer
109
- ref = { navigation }
110
- onReady = { ( ) => {
111
- reactNavigationInstrumentation . registerNavigationContainer (
112
- navigation ,
113
- ) ;
114
- } } >
115
- < Stack . Navigator >
116
- < Stack . Screen name = "Home" component = { HomeScreen } />
117
- < Stack . Screen name = "Tracker" component = { TrackerScreen } />
118
- < Stack . Screen
119
- name = "ManualTracker"
120
- component = { ManualTrackerScreen }
121
- />
122
- < Stack . Screen
123
- name = "PerformanceTiming"
124
- component = { PerformanceTimingScreen }
125
- />
126
- < Stack . Screen name = "Redux" component = { ReduxScreen } />
127
- < Stack . Screen name = "Gestures" component = { GesturesTracingScreen } />
128
- </ Stack . Navigator >
129
- </ NavigationContainer >
126
+ < Stack . Navigator >
127
+ < Stack . Screen
128
+ name = "PerformanceScreen"
129
+ component = { PerformanceScreen }
130
+ options = { { title : 'Performance' } }
131
+ />
132
+ < Stack . Screen name = "Tracker" component = { TrackerScreen } />
133
+ < Stack . Screen name = "ManualTracker" component = { ManualTrackerScreen } />
134
+ < Stack . Screen
135
+ name = "PerformanceTiming"
136
+ component = { PerformanceTimingScreen }
137
+ />
138
+ < Stack . Screen name = "Redux" component = { ReduxScreen } />
139
+ < Stack . Screen name = "Gestures" component = { GesturesTracingScreen } />
140
+ </ Stack . Navigator >
130
141
</ Provider >
131
142
</ GestureHandlerRootView >
132
143
) ;
133
144
} ;
134
145
146
+ function BottomTabs ( ) {
147
+ const navigation = React . useRef < NavigationContainerRef < { } > > ( null ) ;
148
+
149
+ return (
150
+ < NavigationContainer
151
+ ref = { navigation }
152
+ onReady = { ( ) => {
153
+ reactNavigationInstrumentation . registerNavigationContainer ( navigation ) ;
154
+ } } >
155
+ < Tab . Navigator
156
+ screenOptions = { {
157
+ headerShown : false ,
158
+ } }
159
+ detachInactiveScreens = { false } // workaround for https://github.com/react-navigation/react-navigation/issues/11384
160
+ >
161
+ < Tab . Screen
162
+ name = "ErrorsTab"
163
+ component = { TabOneStack }
164
+ options = { {
165
+ tabBarLabel : 'Errors' ,
166
+ tabBarIcon : ( { focused, color, size } ) => (
167
+ < Ionicons
168
+ name = { focused ? 'bug' : 'bug-outline' }
169
+ size = { size }
170
+ color = { color }
171
+ />
172
+ ) ,
173
+ } }
174
+ />
175
+ < Tab . Screen
176
+ name = "PerformanceTab"
177
+ component = { TabTwoStack }
178
+ options = { {
179
+ tabBarLabel : 'Performance' ,
180
+ tabBarIcon : ( { focused, color, size } ) => (
181
+ < Ionicons
182
+ name = { focused ? 'speedometer' : 'speedometer-outline' }
183
+ size = { size }
184
+ color = { color }
185
+ />
186
+ ) ,
187
+ } }
188
+ />
189
+ </ Tab . Navigator >
190
+ </ NavigationContainer >
191
+ ) ;
192
+ }
193
+
135
194
const styles = StyleSheet . create ( {
136
195
wrapper : {
137
196
flex : 1 ,
138
197
} ,
139
198
} ) ;
140
199
141
- export default Sentry . wrap ( App ) ;
200
+ export default Sentry . wrap ( BottomTabs ) ;
0 commit comments