-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
82 lines (71 loc) · 2.33 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React, { useState, useEffect } from 'react';
import {
Dimensions,
StyleSheet,
Text,
View,
TouchableOpacity,
} from 'react-native';
const { width, height } = Dimensions.get('window');
import { StatusBar } from 'expo-status-bar';
import { SafeAreaView } from 'react-native-safe-area-context';
//Navigation
import { NavigationContainer, useNavigation } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createDrawerNavigator } from '@react-navigation/drawer';
//Screens
import FavoritesScreen from './src/screens/FavoritesScreen';
import HomeScreen from './src/screens/HomeScreen';
import LoginScreen from './src/screens/LoginScreen';
import ProfileScreen from './src/screens/ProfileScreen';
import SearchScreen from './src/screens/SearchScreen';
import SignUpScreen from './src/screens/SignUpScreen';
import TripScreen from './src/screens/TripScreen';
import TryScreen from './src/screens/TryScreen';
import { Ionicons, AntDesign, FontAwesome } from '@expo/vector-icons';
import DrawerNavigator from './src/navigation/DrawerNavigator';
import { AuthOffStack } from './src/navigation/StackNavigator';
// Redux
import { Provider } from 'react-redux';
import store from './src/redux/store';
import { useDispatch, useSelector } from 'react-redux';
import * as Font from 'expo-font';
export default function App() {
useEffect(() => {
Font.loadAsync({
space: require('./assets/fonts/spaceage.ttf'),
//roboto: require('./assets/fonts/Roboto-Light.ttf'),
});
}, []);
return (
<Provider store={store}>
<SafeAreaView style={{ flex: 1 }}>
<StatusBar style='auto' />
<AppWrapper />
</SafeAreaView>
</Provider>
);
}
const AppWrapper = () => {
const authStatus = useSelector((state) => state.auth.authenticated);
return (
<NavigationContainer>
{authStatus === false ? <DrawerNavigator /> : <AuthOffStack />}
</NavigationContainer>
);
// return (
// <NavigationContainer>
// {authStatus ? <DrawerNavigator /> : <AuthOffStack />}
// </NavigationContainer>
// );
};
const styles = StyleSheet.create({
container: {
flex: 1,
width: width,
height: height,
justifyContent: 'center',
alignItems: 'center',
},
});