-
Notifications
You must be signed in to change notification settings - Fork 0
/
App2.js
163 lines (130 loc) · 3.15 KB
/
App2.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
import React, { Component } from 'react';
import { Text } from 'react-native';
import { Icon } from 'native-base';
import {
createSwitchNavigator,
createStackNavigator,
createAppContainer,
createDrawerNavigator,
createBottomTabNavigator
} from "react-navigation";
import Home from './src/Home';
import Settings from './src/Settings';
import Product1 from './src/Product1';
import Product2 from './src/Product2';
import Detail from './src/Detail';
import Contact from './src/Contact';
import Getinfo from './src/Getinfo';
import Entry from './src/Entry';
import AuthLoader from './src/AuthLoader';
import ModalScreen from './src/ModalScreen';
import Logout from './src/Logout'
class App extends Component {
render() {
return (
<SwitchNavigator />
);
}
}
const ProductStackOne = createStackNavigator({
Product1: {
screen: Product1, navigationOptions: ({ navigation }) => {
return {
header: null,
};
}
},
Settings: {
screen: Settings,
navigationOptions: ({ navigation }) => {
return {
header: null,
};
}
},
})
const ProductStackTwo = createStackNavigator({
Product2: {
screen: Product2, navigationOptions: ({ navigation }) => {
return {
header: null,
};
}
},
Home: {
screen: Home, navigationOptions: ({ navigation }) => {
return {
header: null,
};
}
},
Detail: {
screen: Detail, navigationOptions: ({ navigation }) => {
return {
header: null,
};
}
}
})
const BottomTab = createBottomTabNavigator({
Product1: { screen: ProductStackOne },
Product2: { screen: ProductStackTwo }
}, {
navigationOptions: ({ navigation }) => {
const { routeName } = navigation.state.routes[navigation.state.index]
return {
headerTitle: routeName
}
}
})
const Stack = createStackNavigator({
BottomTab: { screen: BottomTab },
}, {
defaultNavigationOptions: ({ navigation }) => {
return {
headerLeft: (
<Icon
name='ios-menu'
style={{ paddingLeft: 10 }}
onPress={() => navigation.openDrawer()}
/>
)
};
}
})
const Stack1 = createStackNavigator({
Contact: { screen: Contact },
Getinfo: { screen: Getinfo, navigationOptions: { headerLeft: false } },
}, {
defaultNavigationOptions: ({ navigation }) => {
return {
headerLeft: (
<Icon
style={{ paddingLeft: 10 }}
onPress={() => navigation.openDrawer()}
name="ios-menu"
size={30}
/>
)
};
}
})
const Drawer = createDrawerNavigator({
Home: { screen: Stack },
Contact: { screen: Stack1 },
Logout: { screen: Logout }
})
const AuthStack = createStackNavigator({
Entry: { screen: Entry },
ModalScreen: { screen: ModalScreen }
},
{ mode: 'modal', headerMode: 'none' }
);
const SwitchNavigator = createSwitchNavigator({
AuthLoader: { screen: AuthLoader },
Homescreen: { screen: Drawer },
AuthScreen: { screen: AuthStack }
}, {
initialRouteName: 'AuthLoader',
})
export default createAppContainer(SwitchNavigator);