-
Notifications
You must be signed in to change notification settings - Fork 198
/
index.ios.js
123 lines (113 loc) · 3.01 KB
/
index.ios.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* 愁眉弯唇皆是为你从此眉间心上再无一人
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
TabBarIOS,
NavigatorIOS,
} = React;
var JZListView = require('./components/JZListView');
var Home = require('./Home');
var RNMeituan = React.createClass({
getInitialState(){
return {
selectedTab:'home'
}
},
changeTab(tabName){
this.setState({
selectedTab:tabName
});
},
render: function() {
return (
<TabBarIOS>
<TabBarIOS.Item
title = "首页"
icon = {require('image!icon_tabbar_homepage_selected')}
onPress = {()=> this.changeTab('home')}
selected = { this.state.selectedTab === 'home'}>
<NavigatorIOS
style={styles.container}
initialRoute={{
title: '首页',
component: Home,
rightButtonIcon: require('image!icon_tabbar_onsite'),
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title = "上门"
icon = {require('image!icon_tabbar_onsite')}
onPress = {()=> this.changeTab('shangmen')}
selected = { this.state.selectedTab === 'shangmen'}>
<NavigatorIOS
style={styles.container}
initialRoute={{
title: '上门',
component: JZListView,
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title = "商家"
icon = {require('image!icon_tabbar_merchant_normal')}
onPress = {()=> this.changeTab('shangjia')}
selected = { this.state.selectedTab === 'shangjia'}>
<NavigatorIOS
style={styles.container}
initialRoute={{
title: '商家',
component: JZListView,
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title = "我的"
icon = {require('image!icon_tabbar_mine')}
onPress = {()=> this.changeTab('wode')}
selected = { this.state.selectedTab === 'wode'}>
<NavigatorIOS
style={styles.container}
initialRoute={{
title: '我的',
component: JZListView,
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title = "更多"
icon = {require('image!icon_tabbar_misc')}
onPress = {()=> this.changeTab('more')}
selected = { this.state.selectedTab === 'more'}>
<NavigatorIOS
style={styles.container}
initialRoute={{
title: '更多',
component: JZListView,
}}
/>
</TabBarIOS.Item>
</TabBarIOS>
);
}
});
var styles = StyleSheet.create({
pageView:{
backgroundColor: '#fff',
flex:1
},
container:{
flex:1,
backgroundColor:'white',
},
});
AppRegistry.registerComponent('RNMeituan', () => RNMeituan);