2021-11-07 10:11:51 +00:00
|
|
|
import React, { useRef } from 'react';
|
|
|
|
import { routingInstrumentation } from '../libs/sentry/initSentry';
|
2021-04-04 09:11:15 +00:00
|
|
|
import { AppStackParamList, Screen } from 'config/routing';
|
|
|
|
|
2021-11-07 10:11:51 +00:00
|
|
|
import {
|
|
|
|
NavigationContainer,
|
|
|
|
NavigationContainerRef,
|
|
|
|
} from '@react-navigation/native';
|
2021-04-11 08:54:45 +00:00
|
|
|
import { createStackNavigator } from '@react-navigation/stack';
|
2021-04-04 09:11:15 +00:00
|
|
|
import HomeScreen from './HomeScreen/HomeScreen';
|
2021-04-05 10:32:17 +00:00
|
|
|
import TestScreen from './TestScreen/TestScreen';
|
2021-04-04 09:11:15 +00:00
|
|
|
|
|
|
|
const Stack = createStackNavigator<AppStackParamList>();
|
|
|
|
const AppStack = createStackNavigator<AppStackParamList>();
|
|
|
|
|
2021-11-07 10:11:51 +00:00
|
|
|
const AppScreens = () => {
|
|
|
|
return (
|
|
|
|
<AppStack.Navigator screenOptions={{ headerShown: false }}>
|
|
|
|
<Stack.Screen name={Screen.HOME} component={HomeScreen} />
|
|
|
|
<Stack.Screen name={Screen.TEST} component={TestScreen} />
|
|
|
|
</AppStack.Navigator>
|
|
|
|
);
|
|
|
|
};
|
2021-04-04 09:11:15 +00:00
|
|
|
|
2021-04-11 08:54:45 +00:00
|
|
|
const Navigation = () => {
|
2021-11-07 10:11:51 +00:00
|
|
|
const navigation = useRef<NavigationContainerRef>(null);
|
|
|
|
|
|
|
|
const handleReady = () => {
|
|
|
|
routingInstrumentation.registerNavigationContainer(navigation);
|
|
|
|
};
|
|
|
|
|
2021-04-04 09:11:15 +00:00
|
|
|
return (
|
2021-11-07 10:11:51 +00:00
|
|
|
<NavigationContainer ref={navigation} onReady={handleReady}>
|
2021-04-04 09:11:15 +00:00
|
|
|
<AppScreens />
|
|
|
|
</NavigationContainer>
|
|
|
|
);
|
2021-04-11 08:54:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Navigation;
|