-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
162 lines (153 loc) · 5.65 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
153
154
155
156
157
158
159
160
161
162
import 'react-native-gesture-handler';
// Import React and Component
import React from 'react';
import {Platform} from 'react-native';
// Import Navigators from React Navigation
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
import Icon from 'react-native-vector-icons/FontAwesome5';
// Import Screens
import SplashScreen from './screens/SplashScreen';
import LoginScreen from './screens/LoginScreen';
import RegisterScreen from './screens/RegisterScreen';
import Home from './screens/maintabs/Home';
import Profile from './screens/maintabs/Profile';
import Notification from './screens/maintabs/Notification';
import ShortCut from './screens/maintabs/ShortCut';
import Friend from './screens/maintabs/Friend';
import {STATUSBAR_HEIGHT} from './constants';
import {navigationRef} from './RootNavigation';
const Stack = createStackNavigator();
const RootStack = createStackNavigator();
const Tab = createMaterialTopTabNavigator();
const Auth = () => {
// Stack Navigator for Login and Sign up Screen
return (
<Stack.Navigator initialRouteName="LoginScreen">
<Stack.Screen
name="LoginScreen"
component={LoginScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="RegisterScreen"
component={RegisterScreen}
options={{
title: 'Register', //Set Header Title
headerStyle: {
backgroundColor: '#d3dde8', //Set Header color
},
headerTintColor: '#fff', //Set Header text color
headerTitleStyle: {
fontWeight: 'bold', //Set Header text style
},
}}
/>
</Stack.Navigator>
);
};
const MainTab = () => {
const navigationOptions = {
tabBarStyle: {
paddingTop: STATUSBAR_HEIGHT,
},
tabBarShowIcon: true,
tabBarShowLabel: false,
};
return (
<Tab.Navigator screenOptions={navigationOptions} initialRouteName="Home">
<Tab.Screen
options={{
tabBarIcon: ({tintColor, focused}) => (
<Icon name="home" size={20} color={focused ? '#318bfb' : '#ddd'} />
),
}}
name="Home"
component={Home}
/>
<Tab.Screen
options={{
tabBarIcon: ({tintColor, focused}) => (
<Icon name="users" size={20} color={focused ? '#318bfb' : '#ddd'} />
),
}}
name="Friend"
component={Friend}
/>
<Tab.Screen
options={{
tabBarIcon: ({tintColor, focused}) => (
<Icon name="user-circle" size={22} color={focused ? '#318bfb' : '#ddd'} />
),
}}
name="Profile"
component={Profile}
/>
<Tab.Screen
options={{
tabBarIcon: ({tintColor, focused}) => (
<Icon name="bell" size={22} color={focused ? '#318bfb' : '#ddd'} />
),
}}
name="Notification"
component={Notification}
/>
<Tab.Screen
options={{
tabBarIcon: ({tintColor, focused}) => (
<Icon name="bars" size={20} color={focused ? '#318bfb' : '#ddd'} />
),
}}
name="ShortCut"
component={ShortCut}
/>
</Tab.Navigator>
);
};
const RootTab = props => {
const TransitionPreset = Platform.OS === 'ios' ? TransitionPresets.ModalSlideFromBottomIOS : {};
const navigationOptions = {
headerShown: false,
...TransitionPreset,
// gestureResponseDistance: {
// vertical: 800,
// },
// showIcon: true,
// showLabel: false,
headerBackVisible: false,
};
return (
<RootStack.Navigator screenOptions={navigationOptions} initialRouteName="MainTab">
<RootStack.Screen name="MainTab" component={MainTab} />
</RootStack.Navigator>
);
};
const App = () => {
const TransitionPreset = Platform.OS === 'ios' ? TransitionPresets.ModalSlideFromBottomIOS : {};
const navigationOptions = {
headerShown: false,
...TransitionPreset,
// gestureResponseDistance: {
// vertical: 800,
// },
};
return (
<NavigationContainer ref={navigationRef}>
<Stack.Navigator initialRouteName="SplashScreen" screenOptions={navigationOptions}>
{/* SplashScreen which will come once for 5 Seconds */}
<Stack.Screen
name="SplashScreen"
component={SplashScreen}
// Hiding header for Splash Screen
options={{headerShown: false}}
/>
{/* Auth Navigator: Include Login and Signup */}
<Stack.Screen name="Auth" component={Auth} options={{headerShown: false}} />
{/* Navigation Drawer as a landing page */}
<Stack.Screen name="RootTab" component={RootTab} options={{headerShown: false}} />
</Stack.Navigator>
</NavigationContainer>
);
};
export default App;