Showing
4 changed files
with
202 additions
and
74 deletions
| @@ -16,7 +16,9 @@ import Main from './src/pages/main'; | @@ -16,7 +16,9 @@ import Main from './src/pages/main'; | ||
| 16 | export default class ProtectGod extends Component { | 16 | export default class ProtectGod extends Component { |
| 17 | render() { | 17 | render() { |
| 18 | return ( | 18 | return ( |
| 19 | - <Main /> | 19 | + <Main |
| 20 | + loginSuccess={false} | ||
| 21 | + /> | ||
| 20 | ); | 22 | ); |
| 21 | } | 23 | } |
| 22 | } | 24 | } |
src/pages/Login.js
0 → 100644
| 1 | +import React, { Component } from "react"; | ||
| 2 | +import { | ||
| 3 | + AppRegistry, | ||
| 4 | + StyleSheet, | ||
| 5 | + Text, | ||
| 6 | + View, | ||
| 7 | + Image, | ||
| 8 | + TouchableOpacity, | ||
| 9 | + ScrollView, | ||
| 10 | +} from "react-native"; | ||
| 11 | + | ||
| 12 | +export default class Login extends Component { | ||
| 13 | + constructor(props) { | ||
| 14 | + super(props); | ||
| 15 | + this.state = {}; | ||
| 16 | + } | ||
| 17 | + componentDidMount() { | ||
| 18 | + console.log("thisprops", this.props); | ||
| 19 | + } | ||
| 20 | + render() { | ||
| 21 | + return ( | ||
| 22 | + <View style={styles.container}> | ||
| 23 | + <Text>我是登录页面</Text> | ||
| 24 | + </View> | ||
| 25 | + ); | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +const styles = StyleSheet.create({ | ||
| 30 | + container: { | ||
| 31 | + flex: 1, | ||
| 32 | + paddingTop: 64, | ||
| 33 | + justifyContent: "flex-start", | ||
| 34 | + alignItems: "stretch", | ||
| 35 | + backgroundColor: "white", | ||
| 36 | + paddingLeft: 38, | ||
| 37 | + paddingRight: 38, | ||
| 38 | + }, | ||
| 39 | +}); |
src/pages/Mine/Login.js
deleted
100644 → 0
File mode changed
| @@ -13,7 +13,7 @@ import Home from "./Home/index"; | @@ -13,7 +13,7 @@ import Home from "./Home/index"; | ||
| 13 | import InsuranceCircle from "./InsuranceCircle/index"; | 13 | import InsuranceCircle from "./InsuranceCircle/index"; |
| 14 | import InsuranceChurch from "./InsuranceChurch/index"; | 14 | import InsuranceChurch from "./InsuranceChurch/index"; |
| 15 | import Mine from "./Mine/index"; | 15 | import Mine from "./Mine/index"; |
| 16 | - | 16 | +import Login from "./Login"; |
| 17 | 17 | ||
| 18 | var scale = Dimensions.get('window').scale; | 18 | var scale = Dimensions.get('window').scale; |
| 19 | 19 | ||
| @@ -21,87 +21,174 @@ export default class Main extends Component { | @@ -21,87 +21,174 @@ export default class Main extends Component { | ||
| 21 | constructor(props) { | 21 | constructor(props) { |
| 22 | super(props); | 22 | super(props); |
| 23 | this.state = { | 23 | this.state = { |
| 24 | - selectedItem: "home" | 24 | + selectedItem: "home", |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | + componentWillMount() { | ||
| 29 | + console.log("loginSuccess",this.props); | ||
| 30 | + } | ||
| 31 | + | ||
| 28 | render() { | 32 | render() { |
| 33 | + // {this.state.loginSuccess ? {} : {}} | ||
| 34 | + const { loginSuccess } = this.props; | ||
| 29 | return ( | 35 | return ( |
| 30 | - <TabBarIOS tintColor="#08CC6A" barTintColor="white"> | 36 | + loginSuccess |
| 31 | - <TabBarIOS.Item | 37 | + ? ( |
| 32 | - title="首页" | 38 | + <TabBarIOS tintColor="#08CC6A" barTintColor="white"> |
| 33 | - icon={require("../assets/tabbar/ic_home_n.png")} | 39 | + <TabBarIOS.Item |
| 34 | - selected={this.state.selectedItem == "home"} | 40 | + title="首页" |
| 35 | - onPress={() => { | 41 | + icon={require("../assets/tabbar/ic_home_n.png")} |
| 36 | - this.setState({ | 42 | + selected={this.state.selectedItem == "home"} |
| 37 | - selectedItem: "home" | 43 | + onPress={() => { |
| 38 | - }); | 44 | + this.setState({ |
| 39 | - }} | 45 | + selectedItem: "home" |
| 40 | - > | 46 | + }); |
| 41 | - <NavigatorIOS | ||
| 42 | - style={{ flex: 1 }} | ||
| 43 | - initialRoute={{ | ||
| 44 | - component: Home, | ||
| 45 | - title: "保护神" | ||
| 46 | }} | 47 | }} |
| 47 | - | 48 | + > |
| 48 | - /> | 49 | + <NavigatorIOS |
| 49 | - </TabBarIOS.Item> | 50 | + style={{ flex: 1 }} |
| 50 | - <TabBarIOS.Item | 51 | + initialRoute={{ |
| 51 | - title="保圈" | 52 | + component: Home, |
| 52 | - icon={require("../assets/tabbar/ic_circle_n.png")} | 53 | + title: "保护神" |
| 53 | - selected={this.state.selectedItem == "insuranceCircle"} | 54 | + }} |
| 54 | - onPress={() => { | 55 | + |
| 55 | - this.setState({ | 56 | + /> |
| 56 | - selectedItem: "insuranceCircle" | 57 | + </TabBarIOS.Item> |
| 57 | - }); | 58 | + <TabBarIOS.Item |
| 58 | - }} | 59 | + title="保圈" |
| 59 | - > | 60 | + icon={require("../assets/tabbar/ic_circle_n.png")} |
| 60 | - <NavigatorIOS | 61 | + selected={this.state.selectedItem == "insuranceCircle"} |
| 61 | - style={{ flex: 1 }} | 62 | + onPress={() => { |
| 62 | - initialRoute={{ | 63 | + this.setState({ |
| 63 | - component: InsuranceCircle, | 64 | + selectedItem: "insuranceCircle" |
| 64 | - title: "保护神", | 65 | + }); |
| 65 | }} | 66 | }} |
| 66 | - /> | 67 | + > |
| 67 | - </TabBarIOS.Item> | 68 | + <NavigatorIOS |
| 68 | - <TabBarIOS.Item | 69 | + style={{ flex: 1 }} |
| 69 | - title="保堂" | 70 | + initialRoute={{ |
| 70 | - icon={require("../assets/tabbar/ic_umbrella_n.png")} | 71 | + component: InsuranceCircle, |
| 71 | - selected={this.state.selectedItem == "insuranceChurch"} | 72 | + title: "保护神", |
| 72 | - onPress={() => { | 73 | + }} |
| 73 | - this.setState({ | 74 | + /> |
| 74 | - selectedItem: "insuranceChurch" | 75 | + </TabBarIOS.Item> |
| 75 | - }); | 76 | + <TabBarIOS.Item |
| 76 | - }} | 77 | + title="保堂" |
| 77 | - > | 78 | + icon={require("../assets/tabbar/ic_umbrella_n.png")} |
| 78 | - <NavigatorIOS | 79 | + selected={this.state.selectedItem == "insuranceChurch"} |
| 79 | - style={{ flex: 1 }} | 80 | + onPress={() => { |
| 80 | - initialRoute={{ | 81 | + this.setState({ |
| 81 | - component: InsuranceChurch, | 82 | + selectedItem: "insuranceChurch" |
| 82 | - title: "保护神" | 83 | + }); |
| 83 | }} | 84 | }} |
| 84 | - /> | 85 | + > |
| 85 | - </TabBarIOS.Item> | 86 | + <NavigatorIOS |
| 86 | - <TabBarIOS.Item | 87 | + style={{ flex: 1 }} |
| 87 | - title="我的" | 88 | + initialRoute={{ |
| 88 | - icon={require("../assets/tabbar/ic_mine_n.png")} | 89 | + component: InsuranceChurch, |
| 89 | - selected={this.state.selectedItem == "mine"} | 90 | + title: "保护神" |
| 90 | - onPress={() => { | 91 | + }} |
| 91 | - this.setState({ | 92 | + /> |
| 92 | - selectedItem: "mine" | 93 | + </TabBarIOS.Item> |
| 93 | - }); | 94 | + <TabBarIOS.Item |
| 94 | - }} | 95 | + title="我的" |
| 95 | - > | 96 | + icon={require("../assets/tabbar/ic_mine_n.png")} |
| 96 | - <NavigatorIOS | 97 | + selected={this.state.selectedItem == "mine"} |
| 97 | - style={{ flex: 1 }} | 98 | + onPress={() => { |
| 98 | - initialRoute={{ | 99 | + this.setState({ |
| 99 | - component: Mine, | 100 | + selectedItem: "mine" |
| 100 | - title: "保护神" | 101 | + }); |
| 101 | }} | 102 | }} |
| 102 | - /> | 103 | + > |
| 103 | - </TabBarIOS.Item> | 104 | + <NavigatorIOS |
| 104 | - </TabBarIOS> | 105 | + style={{ flex: 1 }} |
| 106 | + initialRoute={{ | ||
| 107 | + component: Mine, | ||
| 108 | + title: "保护神" | ||
| 109 | + }} | ||
| 110 | + /> | ||
| 111 | + </TabBarIOS.Item> | ||
| 112 | + </TabBarIOS> | ||
| 113 | + ) | ||
| 114 | + : ( | ||
| 115 | + <Login /> | ||
| 116 | + ) | ||
| 117 | + // <TabBarIOS tintColor="#08CC6A" barTintColor="white"> | ||
| 118 | + // <TabBarIOS.Item | ||
| 119 | + // title="首页" | ||
| 120 | + // icon={require("../assets/tabbar/ic_home_n.png")} | ||
| 121 | + // selected={this.state.selectedItem == "home"} | ||
| 122 | + // onPress={() => { | ||
| 123 | + // this.setState({ | ||
| 124 | + // selectedItem: "home" | ||
| 125 | + // }); | ||
| 126 | + // }} | ||
| 127 | + // > | ||
| 128 | + // <NavigatorIOS | ||
| 129 | + // style={{ flex: 1 }} | ||
| 130 | + // initialRoute={{ | ||
| 131 | + // component: Home, | ||
| 132 | + // title: "保护神" | ||
| 133 | + // }} | ||
| 134 | + | ||
| 135 | + // /> | ||
| 136 | + // </TabBarIOS.Item> | ||
| 137 | + // <TabBarIOS.Item | ||
| 138 | + // title="保圈" | ||
| 139 | + // icon={require("../assets/tabbar/ic_circle_n.png")} | ||
| 140 | + // selected={this.state.selectedItem == "insuranceCircle"} | ||
| 141 | + // onPress={() => { | ||
| 142 | + // this.setState({ | ||
| 143 | + // selectedItem: "insuranceCircle" | ||
| 144 | + // }); | ||
| 145 | + // }} | ||
| 146 | + // > | ||
| 147 | + // <NavigatorIOS | ||
| 148 | + // style={{ flex: 1 }} | ||
| 149 | + // initialRoute={{ | ||
| 150 | + // component: InsuranceCircle, | ||
| 151 | + // title: "保护神", | ||
| 152 | + // }} | ||
| 153 | + // /> | ||
| 154 | + // </TabBarIOS.Item> | ||
| 155 | + // <TabBarIOS.Item | ||
| 156 | + // title="保堂" | ||
| 157 | + // icon={require("../assets/tabbar/ic_umbrella_n.png")} | ||
| 158 | + // selected={this.state.selectedItem == "insuranceChurch"} | ||
| 159 | + // onPress={() => { | ||
| 160 | + // this.setState({ | ||
| 161 | + // selectedItem: "insuranceChurch" | ||
| 162 | + // }); | ||
| 163 | + // }} | ||
| 164 | + // > | ||
| 165 | + // <NavigatorIOS | ||
| 166 | + // style={{ flex: 1 }} | ||
| 167 | + // initialRoute={{ | ||
| 168 | + // component: InsuranceChurch, | ||
| 169 | + // title: "保护神" | ||
| 170 | + // }} | ||
| 171 | + // /> | ||
| 172 | + // </TabBarIOS.Item> | ||
| 173 | + // <TabBarIOS.Item | ||
| 174 | + // title="我的" | ||
| 175 | + // icon={require("../assets/tabbar/ic_mine_n.png")} | ||
| 176 | + // selected={this.state.selectedItem == "mine"} | ||
| 177 | + // onPress={() => { | ||
| 178 | + // this.setState({ | ||
| 179 | + // selectedItem: "mine" | ||
| 180 | + // }); | ||
| 181 | + // }} | ||
| 182 | + // > | ||
| 183 | + // <NavigatorIOS | ||
| 184 | + // style={{ flex: 1 }} | ||
| 185 | + // initialRoute={{ | ||
| 186 | + // component: Mine, | ||
| 187 | + // title: "保护神" | ||
| 188 | + // }} | ||
| 189 | + // /> | ||
| 190 | + // </TabBarIOS.Item> | ||
| 191 | + // </TabBarIOS> | ||
| 105 | ); | 192 | ); |
| 106 | } | 193 | } |
| 107 | } | 194 | } |
-
Please register or login to post a comment