AppNavigation.js 2.19 KB
Newer Older
1 2
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
3 4 5
import * as React from 'react';
import ForgotPassword from '../screens/authentication/forgot_password/ForgotPasswordContainer';
import IntroScreen from '../screens/authentication/introduction/IntroductionContainer';
6
import LoginScreen from '../screens/authentication/login/LoginContainer';
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
7
import ServerScreen from '../screens/authentication/server/ServerContainer';
8 9 10 11
import SignUpScreen from '../screens/authentication/signup/SignUpContainer';
import SplashContainer from '../screens/authentication/splash/SlashContainer';
import ProfileContainer from '../screens/profile/ProfileContainer';
import SalaryScreen from '../screens/salary/SalaryContainer';
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
12
import ConfirmedShiftDetail from '../screens/shift/shift-tabs/ConfirmedShiftScreen/ConfirmedShiftDetail/ConfirmedShiftDetailContainer';
13 14 15 16

import {APP_NAVIGATE_SCREEN} from '../utils/constant';
import BottomTabs from './BottomTabNavigation';
import RootNavigation from './RootNavigation';
17
import HomeScreen from '../screens/home';
18 19 20 21 22 23 24 25 26 27 28 29

const {
  INTRO,
  SERVER,
  LOGIN,
  MAIN,
  SIGN_UP,
  SPLASH,
  PROFILE,
  FORGOT_PASS,
  CONFIRM_SHIFT_DETAIL,
  SALARY,
30
  HOME,
31 32 33
} = APP_NAVIGATE_SCREEN;
const AppScreen = {
  [SPLASH]: SplashContainer,
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
34
  [SERVER]: ServerScreen,
35 36 37 38 39 40 41 42 43
  [LOGIN]: LoginScreen,
  [SIGN_UP]: SignUpScreen,
  [PROFILE]: ProfileContainer,
  [FORGOT_PASS]: ForgotPassword,
  // [MAIN]: Tabs,
  [MAIN]: BottomTabs,
  [CONFIRM_SHIFT_DETAIL]: ConfirmedShiftDetail,
  [SALARY]: SalaryScreen,
  [INTRO]: IntroScreen,
44
  [HOME]: HomeScreen,
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
};
const Stack = createNativeStackNavigator();

function AppNavigation() {
  return (
    <NavigationContainer
      linking={{
        prefixes: 'anawork://app',
      }}
      ref={navigatorRef => {
        RootNavigation.setTopLevelNavigator(navigatorRef);
      }}>
      <Stack.Navigator
        initialRouteName={SPLASH}
        screenOptions={{headerShown: false}}>
        {Object.keys(AppScreen).map((item, index) => (
          <Stack.Screen key={index} name={item} component={AppScreen[item]} />
        ))}
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default AppNavigation;