-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
152 lines (135 loc) · 3.78 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import React, { useState, useEffect } from "react";
import { createAppContainer, createSwitchNavigator } from "react-navigation";
import { createStackNavigator } from 'react-navigation-stack';
import { createBottomTabNavigator } from "react-navigation-tabs";
import { View, Header } from "react-native";
import { AppLoading, SplashScreen } from "expo";
import { Provider } from 'react-redux'
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import rootReducer from './src/reducers'
import Icon from "react-native-vector-icons/FontAwesome5";
import * as Font from "expo-font";
import mainStyle from "./styles/main";
import { colors } from './styles/variables';
import LoginScreen from "./src/Components/LoginScreen";
import SignUpScreen from "./src/Components/SignUpScreen";
import AuthLoadingScreen from "./src/Components/AuthLoadingScreen";
import SplashLoadingScreen from "./src/Components/SplashLoadingScreen";
import SecondSignUpScreen from "./src/Components/SecondSignUpScreen";
import ModalArt from './src/Components/ModalArt/ModalArt';
import cameraScreen from "./src/containers/cameraScreen";
import mapScreen from "./src/containers/mapScreen";
import profileScreen from "./src/containers/profileScreen";
import feedScreen from "./src/containers/feedScreen";
const store = createStore(rootReducer, applyMiddleware(thunkMiddleware));
const AppStack = createBottomTabNavigator(
{
Map: mapScreen,
Feed: feedScreen,
Camera: cameraScreen,
Profile: profileScreen
},
{
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
const { routeName } = navigation.state;
let IconComponent = Icon;
let iconName;
switch (routeName) {
case "Map":
iconName = "map";
break;
case "Profile":
iconName = "ghost";
break;
case "Camera":
iconName = "camera-retro";
break;
case "Feed":
iconName = "broadcast-tower";
break;
default:
return;
}
return <IconComponent name={iconName} navigation={navigation} size={30} color={colors.tabButts} style={{
paddingTop: 10,
paddingBottom: 10
}} />;
},
headerStyle: {
backgroundColor: '#f4511e',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}),
tabBarOptions: {
showLabel: false,
activeTintColor: "#39c2c9",
inactiveTintColor: "#363a43",
style: mainStyle.tabBar
}
}
);
const RootStack = createStackNavigator(
{
Main: {
screen: AppStack,
},
ArtModal: {
screen: ModalArt,
},
},
{
mode: 'modal',
headerMode: 'none',
}
);
const AuthStack = createStackNavigator({
Login: {
screen: LoginScreen,
navigationOptions: {
header: null
}
},
SignUp: {
screen: SignUpScreen,
navigationOptions: {
header: null
}
}
});
let Navigation = createAppContainer(
createSwitchNavigator(
{
AuthLoading: AuthLoadingScreen,
App: RootStack,
Auth: AuthStack,
Splash: SplashLoadingScreen,
SecondSignup: SecondSignUpScreen
},
{
initialRouteName: "AuthLoading"
}
));
export default App = ({navigation}) => {
const [fontLoaded, setLoaded] = useState(false);
const [user, setUser] = useState({});
useEffect(() => {
loadFonts();
}, []);
const loadFonts = async () => {
await Font.loadAsync({
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf")
});
setLoaded(true);
};
return (
<Provider store={store}>
<Navigation />
</Provider>
)
}