-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
109 lines (98 loc) · 2.93 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
import React from 'react';
import LoginForm from './src/Login/LoginForm';
import Register from './src/Register/Register';
import Timeline from './src/Timeline/Timeline';
import Post from './src/Product/Post';
import Profile from './src/Profile/Profile';
import ViewProduct from './src/Timeline/ViewProduct';
import Notification from './src/Notification/Notification';
import IconWithBadge from './src/Utility/IconWithBadge';
import Inbox from './src/Inbox/Inbox';
import {createBottomTabNavigator,createStackNavigator,createSwitchNavigator, createAppContainer } from "react-navigation";
import { Font } from 'expo';
import { Asset } from 'expo';
import { Ionicons } from '@expo/vector-icons';
const AuthStack = createStackNavigator(
{
LoginScreen: {screen:LoginForm,navigationOptions: { header: null }},
RegisterScreen: {screen: Register,navigationOptions: { header: null }},
},
{
initialRouteName: "LoginScreen",
}
);
const UthStack = createStackNavigator(
{
ViewProduct: {screen:ViewProduct,navigationOptions: { header: null }},
Timeline: {screen:Timeline},
}
);
const AppStack = createBottomTabNavigator(
{
Timeline:Timeline,
Product: Post,
Notification: Notification,
Profile: Profile,
Inbox:Inbox
},
{
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
const { routeName } = navigation.state;
let IconComponent = Ionicons;
let iconName; let badgeCount;
if (routeName === 'Timeline') {
iconName = `ios-home`;
// Sometimes we want to add badges to some icons.
// You can check the implementation below.
IconComponent = IconWithBadge;
} else if (routeName === 'Product') {
iconName = `ios-add-circle`;
} else if(routeName === 'Profile'){
iconName = `md-person`;
}else if(routeName === 'Notification'){
iconName = `ios-notifications`;
badgeCount = 4;
}else if(routeName === 'Inbox'){
iconName = `md-chatboxes`;
badgeCount = 3;
}
// You can return any component that you like here!
return <IconComponent badgeCount={badgeCount} name={iconName} size={25} color={tintColor} screen={routeName} />;
},
}),
tabBarOptions: {
activeTintColor: 'green',
inactiveTintColor: 'gray',
},
}
)
const AppContainer = createAppContainer(
createSwitchNavigator(
{
Auth: AuthStack,
App: AppStack,
Uth: UthStack
}
));
export default class App extends React.Component {
constructor(){
super();
this.state = {
fontLoaded: false
}
}
async componentDidMount(){
await Font.loadAsync({
'lato': require('./assets/fonts/Lato-Regular.ttf'),
'lato-bold': require('./assets/fonts/Lato-Bold.ttf')
}).then(() => {
this.setState({fontLoaded:true})
})
}
render() {
return (
<AppContainer/>
);
}
}