Fakultas Ilmu Komputer UI

index.tsx 1.23 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
8
9

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

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

14
15
16
17
const Stack = createStackNavigator();

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

export default App;