-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
145 lines (132 loc) · 3.72 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
//This is an example code for Bottom Navigation//
import React from 'react';
import { Button, Text, View, TouchableOpacity, StyleSheet } from 'react-native';
//import all the basic component we have used
//import Ionicons to show the icon for bottom options
//For React Navigation 2.+ import following
//import {createStackNavigator,createBottomTabNavigator} from 'react-navigation';
//For React Navigation 3.+ import following
import {
createAppContainer,
} from 'react-navigation';
import {
createStackNavigator,
} from 'react-navigation-stack';
import {
createBottomTabNavigator,
} from 'react-navigation-tabs';
// import { Icon } from 'react-native-elements';
import Entypo from 'react-native-vector-icons/Entypo';
import Ionicons from 'react-native-vector-icons/Ionicons';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import {
Menu,
MenuOptions,
MenuOption,
MenuTrigger,
} from 'react-native-popup-menu';
//import createStackNavigator, createBottomTabNavigator, createAppContainer in our project
import StoreScreen from './pages/StoreScreen';
import SettingsScreen from './pages/SettingsScreen';
import ChatScreen from './pages/ChatScreen';
import ProfileScreen from './pages/ProfileScreen';
import FriendsScreen from './pages/FriendsScreen';
export default class App extends React.Component {
constructor(props)
{
super(props);
}
render(){
return(
<AppContainer></AppContainer>
)
}
}
const FriendsStack= createStackNavigator(
{
Friends: {
screen: FriendsScreen,
navigationOptions: {
title: 'Bobrok Friends',
}
},
Chat: {
screen: ChatScreen,
navigationOptions: {
title: 'Bobrok Chats',
header: null,
},
},
},
);
FriendsStack.navigationOptions= ({navigation})=> {
let tabBarVisible= true;
if(navigation.state.index > 0)
{
tabBarVisible= false;
}
return {
tabBarVisible,
};
};
const StoreStack= createStackNavigator(
{
Store: { screen: StoreScreen },
},
{
defaultNavigationOptions: {
title: 'Bobrok Store',
headerStyle: {
backgroundColor: 'yellow',
},
headerTintColor: 'black',
headerTintStyle: {
fontWeight: 'bold',
},
headerMode: "float",
},
}
);
const SettingsStack= createStackNavigator(
{
Settings: { screen: SettingsScreen },
Profile: { screen: ProfileScreen },
},
{
defaultNavigationOptions: {
title: 'Bobrok Settings',
},
}
);
const Nav= createBottomTabNavigator(
{
Friends: { screen: FriendsStack },
Store: { screen: StoreStack },
Settings: { screen: SettingsStack },
},
{
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, tintColor }) => {
const { routeName } = navigation.state;
let IconComponent= FontAwesome5;
let iconName;
if (routeName === 'Friends') {
iconName = `user-friends${focused ? '' : ''}`;
} else if (routeName === 'Store') {
iconName = `search-dollar${focused ? '' : ''}`;
} else if (routeName === 'Settings') {
iconName = `user-circle${focused ? '' : ''}`;
}
return <IconComponent name={iconName} size={25} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: 'black',
inactiveTintColor: 'black',
activeBackgroundColor: 'yellow',
inactiveBackgroundColor: 'gray',
},
},
);
const AppContainer= createAppContainer(Nav);