-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathApp.tsx
40 lines (35 loc) · 1.27 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import React from 'react';
import { Provider as PaperProvider } from 'react-native-paper';
import TopBar from './src/components/topBar';
import theme from './src/theme';
import { RootStackParamList } from './src/routes';
import DetailsScreen from './src/screens/details';
import HomeScreen from './src/screens/home';
import 'react-native-gesture-handler';
import { config } from './src/config';
// This ensures that a valid dotenv config is pulled before allowing the app to run,
// helping to avoid unnoticed runtime crashes due to invalid config.
config;
const Stack = createStackNavigator<RootStackParamList>();
enum Routes {
HOME = 'Home',
DETAILS = 'Details',
}
const App: React.FC = () => (
<PaperProvider theme={theme}>
<NavigationContainer theme={theme}>
<Stack.Navigator
initialRouteName={Routes.HOME}
screenOptions={{
header: (props) => <TopBar {...props} />,
}}
>
<Stack.Screen name={Routes.HOME} component={HomeScreen} />
<Stack.Screen name={Routes.DETAILS} component={DetailsScreen} />
</Stack.Navigator>
</NavigationContainer>
</PaperProvider>
);
export default App;