-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
145 lines (94 loc) · 2.45 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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import FontAwesome from 'react-native-vector-icons/FontAwesome'
import { createAppContainer } from 'react-navigation';
import { createBottomTabNavigator } from 'react-navigation-tabs';
import { createStackNavigator } from 'react-navigation-stack';
//----screens import
import MainScreen from "./src/screens/MainScreen"
import SearchServerScreen from "./src/screens/SearchServerScreen"
import AddNumberModal from "./src/screens/AddNumberModal"
import ModalScreen from './src/screens/AddNumberModal';
//--screen import end
//create 2 seperate navigation stack
const MainStack = createStackNavigator(
{
Home : MainScreen,
},
{
defaultNavigationOptions: {
headerStyle: {
backgroundColor: '#192f6a',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
},
}
);
const SearchStack = createStackNavigator(
{
SearchServer:SearchServerScreen,
},
{
defaultNavigationOptions: {
headerStyle: {
backgroundColor: '#192f6a',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
},
}
)
const SearchStackWithModal = createStackNavigator(
{
Main:{
screen: SearchStack,
},
MyModal:{
screen: ModalScreen,
},
},
{
mode: 'modal',
headerMode: 'none',
}
)
const TabNavigator = createBottomTabNavigator({
Home : MainStack,
SearchServer:SearchStackWithModal,
},
{
defaultNavigationOptions:({ navigation }) => ({
tabBarIcon: ({ focused,horizontal,tintColor}) =>{
const { routeName } = navigation.state;
let IconComponent = FontAwesome;
let iconName;
if(routeName === 'Home'){
iconName = "address-book";
}
else if(routeName === 'SearchServer'){
iconName = "search";
}
return <IconComponent name={iconName} size={25} color={tintColor}/>;
},
}),
tabBarOptions:{
activeTintColor:'#fff',
inactiveTintColor:'#fff',
inactiveBackgroundColor:'#3b5998',
activeBackgroundColor:'#192f6a',
showLabel:false,
},
}
);
const AppContainer = createAppContainer(TabNavigator)
export default function App() {
return (
// <MainScreen/>
<AppContainer/>
);
}