Fakultas Ilmu Komputer UI

index.tsx 1.28 KB
Newer Older
1
2
3
import React, { FC } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
4
import { ThemeProvider } from 'react-native-elements';
5
import Toast from 'react-native-toast-message';
6
7
8

import * as ROUTES from 'constants/routes';
import { navigation } from 'constants/navigation';
9
import ContextProvider from 'provider';
10
import { theme } from 'styles/theme';
11

12
import { screenOptions, toastConfig } from './styles';
13

14
15
16
17
const Stack = createStackNavigator();

const App: FC = () => {
  return (
Wulan Mantiri's avatar
Wulan Mantiri committed
18
    <ThemeProvider theme={theme}>
19
20
21
      <ContextProvider>
        <NavigationContainer>
          <Stack.Navigator
22
            initialRouteName={ROUTES.initial}
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
            screenOptions={screenOptions}>
            {navigation.map((nav, i) => (
              <Stack.Screen
                key={`nav${i}`}
                name={nav.name}
                component={nav.component}
                options={{
                  title: nav.header,
                  headerShown: Boolean(nav.header),
                }}
              />
            ))}
          </Stack.Navigator>
        </NavigationContainer>
        <Toast config={toastConfig} ref={Toast.setRef} />
      </ContextProvider>
Wulan Mantiri's avatar
Wulan Mantiri committed
39
    </ThemeProvider>
40
41
42
43
  );
};

export default App;