Fakultas Ilmu Komputer UI

index.tsx 1.16 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 { theme } from 'styles/theme';
10

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

13
14
15
16
const Stack = createStackNavigator();

const App: FC = () => {
  return (
Wulan Mantiri's avatar
Wulan Mantiri committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    <ThemeProvider theme={theme}>
      <NavigationContainer>
        <Stack.Navigator
          initialRouteName={ROUTES.initial}
          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} />
    </ThemeProvider>
37
38
39
40
  );
};

export default App;