main.js
2.49 KB
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
import React, { Component } from "react";
import {
AppRegistry,
StyleSheet,
Text,
View,
TabBarIOS,
NavigatorIOS
} from "react-native";
import Home from "./Home/index";
import InsuranceCircle from "./InsuranceCircle/index";
import InsuranceChurch from "./InsuranceChurch/index";
import Mine from "./Mine/index";
export default class Main extends Component {
constructor(props) {
super(props);
this.state = {
selectedItem: "home"
}
}
render() {
return (
<TabBarIOS tintColor="#08CC6A" barTintColor="white">
<TabBarIOS.Item
title="首页"
selected={this.state.selectedItem == "home"}
onPress={() => {
this.setState({
selectedItem: "home"
});
}}
>
<NavigatorIOS
style={{ flex: 1 }}
initialRoute={{
component: Home,
title: "保护神"
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title="保圈"
selected={this.state.selectedItem == "insuranceCircle"}
onPress={() => {
this.setState({
selectedItem: "insuranceCircle"
});
}}
>
<NavigatorIOS
style={{ flex: 1 }}
initialRoute={{
component: InsuranceCircle,
title: "保护神",
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title="保堂"
selected={this.state.selectedItem == "insuranceChurch"}
onPress={() => {
this.setState({
selectedItem: "insuranceChurch"
});
}}
>
<NavigatorIOS
style={{ flex: 1 }}
initialRoute={{
component: InsuranceChurch,
title: "保护神"
}}
/>
</TabBarIOS.Item>
<TabBarIOS.Item
title="我的"
selected={this.state.selectedItem == "mine"}
onPress={() => {
this.setState({
selectedItem: "mine"
});
}}
>
<NavigatorIOS
style={{ flex: 1 }}
initialRoute={{
component: Mine,
title: "保护神"
}}
/>
</TabBarIOS.Item>
</TabBarIOS>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF"
}
});