forked from scorelab/Go-social
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
125 lines (108 loc) · 3.47 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
import React, { Component } from "react";
import { AppRegistry, Dimensions, ActivityIndicator, AsyncStorage, View, StyleSheet, StatusBar } from "react-native";
import { createStackNavigator, createSwitchNavigator, createBottomTabNavigator, createAppContainer } from "react-navigation";
import Ionicons from "react-native-vector-icons/FontAwesome";
//Components
import HomeScreen from "./app/screens/HomeScreen/homeScreen";
import MapScreen from "./app/screens/MapScreen/mapScreen";
import ProfileScreen from "./app/screens/ProfileScreen/profileScreen";
import LoginScreen from "./app/screens/LoginScreen/loginScreen";
import ChatListScreen from "./app/screens/ChatListScreen/chatListScreen";
import SignupScreen from "./app/screens/SignupScreen/signupScreen";
import NotificationScreen from "./app/screens/NotificationScreen/notificationScreen";
import ForgotPasswordScreen from "./app/screens/ForgotPasswordScreen/forgotPasswordScreen";
import NewPostScreen from "./app/screens/NewPostScreen/NewPostScreen";
import MessageScreen from "./app/screens/MessaginScreen/messaginScreen";
import ForumScreen from './app/screens/ForumScreen/forumScreen';
//Screen names
import { Home, Info, DetailView, Login } from "./app/screens/index";
//Screen size
var {height, width} = Dimensions.get("window");
class AuthLoadingScreen extends Component {
constructor() {
super();
this._bootstrapAsync();
}
_bootstrapAsync = async () => {
const userToken = await AsyncStorage.getItem("userToken");
this.props.navigation.navigate(userToken ? "Auth" : "Auth");
};
render() {
return (
<View style={styles.container}>
<ActivityIndicator/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
});
const AppStack = createBottomTabNavigator(
{
Home: { screen: HomeScreen },
Forum : { screen: ForumScreen},
Messages : { screen: ChatListScreen },
Map : { screen: MapScreen },
Notifications : { screen: NotificationScreen },
Profile: { screen: ProfileScreen }
},
{
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, tintColor }) => {
const { routeName } = navigation.state;
let iconName;
if (routeName === "Home") {
iconName = "home";
} else if (routeName === "Forum") {
iconName = "chatbox-outline";
} else if (routeName === "Messages") {
iconName = "comment";
} else if (routeName === "Map") {
iconName = "map";
} else if (routeName === "Notifications") {
iconName = "bell";
} else if (routeName === "Profile") {
iconName = "user";
}
return <Ionicons name={iconName} size={25} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: "#3d9bf9",
inactiveTintColor: "gray",
},
}
);
const AuthStack = createStackNavigator(
{
Login:{
screen:LoginScreen
},
Signup:{
screen:SignupScreen
},
ForgotPassword:{
screen:ForgotPasswordScreen
},
NewPost:{
screen:NewPostScreen
},
MessageView:{
screen:MessageScreen
},
App:{
screen:AppStack
}
},{
initialRouteName:"Login",
mode: 'modal',
headerMode:"none"
}
)
const AppContainer = createAppContainer(AuthStack);
export default AppContainer;