Fakultas Ilmu Komputer UI

index.tsx 1.35 KB
Newer Older
1
import 'react-native-gesture-handler';
2
3
4
import React, { FC } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
5
6
import { ThemeProvider } from 'react-native-elements';
import { SafeAreaProvider } from 'react-native-safe-area-context';
7
import Toast from 'react-native-toast-message';
8
9
10

import * as ROUTES from 'constants/routes';
import { navigation } from 'constants/navigation';
11
import { theme } from 'styles/theme';
12

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

15
16
17
18
const Stack = createStackNavigator();

const App: FC = () => {
  return (
19
20
21
    <SafeAreaProvider>
      <ThemeProvider theme={theme}>
        <NavigationContainer>
22
          <Stack.Navigator
23
            initialRouteName={ROUTES.initial}
24
25
26
27
28
29
30
31
32
33
34
            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),
                }}
              />
35
36
37
            ))}
          </Stack.Navigator>
        </NavigationContainer>
38
        <Toast config={toastConfig} ref={Toast.setRef} />
39
40
      </ThemeProvider>
    </SafeAreaProvider>
41
42
43
44
  );
};

export default App;