罗广聪

grid 框架OK

@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 "dependencies": { 9 "dependencies": {
10 "react": "16.0.0-alpha.12", 10 "react": "16.0.0-alpha.12",
11 "react-native": "0.48.1", 11 "react-native": "0.48.1",
  12 + "react-native-easy-grid": "^0.1.15",
12 "react-native-swiper": "^1.5.11", 13 "react-native-swiper": "^1.5.11",
13 "react-navigation": "^1.0.0-beta.11" 14 "react-navigation": "^1.0.0-beta.11"
14 }, 15 },
@@ -11,11 +11,35 @@ import { @@ -11,11 +11,35 @@ import {
11 Dimensions 11 Dimensions
12 } from "react-native"; 12 } from "react-native";
13 import { StackNavigator, TabNavigator } from "react-navigation"; 13 import { StackNavigator, TabNavigator } from "react-navigation";
  14 +import { Col, Row, Grid } from "react-native-easy-grid";
14 15
15 export default class Home extends Component { 16 export default class Home extends Component {
16 constructor(props) { 17 constructor(props) {
17 super(props); 18 super(props);
18 - this.state = {}; 19 + this.state = {
  20 + gridData: {
  21 + title: ["角色","建议产品","建议保额","保险年限","缴费期限","年缴保费"],
  22 + products: [{
  23 + name: "成人意外险",
  24 + price: "50W",
  25 + long: "1年",
  26 + year: "20年",
  27 + eachyear: "150元",
  28 + },{
  29 + name: "成人意外险",
  30 + price: "50W",
  31 + long: "1年",
  32 + year: "20年",
  33 + eachyear: "150元",
  34 + },{
  35 + name: "成人意外险",
  36 + price: "50W",
  37 + long: "1年",
  38 + year: "20年",
  39 + eachyear: "150元",
  40 + }]
  41 + }
  42 + };
19 } 43 }
20 componentWillMount() {} 44 componentWillMount() {}
21 45
@@ -52,6 +76,7 @@ export default class Home extends Component { @@ -52,6 +76,7 @@ export default class Home extends Component {
52 render() { 76 render() {
53 console.log("solution", this.props.navigation.state.params.answerList); 77 console.log("solution", this.props.navigation.state.params.answerList);
54 const { navigate } = this.props.navigation; 78 const { navigate } = this.props.navigation;
  79 + const { gridData } = this.state;
55 return ( 80 return (
56 <View style={styles.container}> 81 <View style={styles.container}>
57 <View style={styles.ownContaier}> 82 <View style={styles.ownContaier}>
@@ -94,9 +119,42 @@ export default class Home extends Component { @@ -94,9 +119,42 @@ export default class Home extends Component {
94 <Text style={styles.headerTitle}>保险配置方案</Text> 119 <Text style={styles.headerTitle}>保险配置方案</Text>
95 </View> 120 </View>
96 </View> 121 </View>
97 - <View style={styles.tableContainer}> 122 + <ScrollView style={styles.tableContainer}>
98 - <Text>表格</Text> 123 + <Grid>
99 - </View> 124 + <Row>
  125 + {gridData.title.map((item,index) => {
  126 + return (
  127 + <Col key={index} style={styles.gridtitleContaier}><Text style={styles.gridheaderText}>{item}</Text></Col>
  128 + )
  129 + })}
  130 + </Row>
  131 + <Row>
  132 + <Col style={styles.actor} size={1}>
  133 + <Text style={styles.contentText}>父亲</Text>
  134 + <Text style={styles.contentText}>42</Text>
  135 + </Col>
  136 + <Col size={5}>
  137 + {
  138 + gridData.products.map((item,index) => {
  139 + return (
  140 + <Row key={index}>
  141 + <Col><Text style={styles.contentText}>{item.name}</Text></Col>
  142 + <Col><Text style={styles.contentText}>{item.price}</Text></Col>
  143 + <Col><Text style={styles.contentText}>{item.long}</Text></Col>
  144 + <Col><Text style={styles.contentText}>{item.year}</Text></Col>
  145 + <Col><Text style={styles.contentText}>{item.eachyear}</Text></Col>
  146 + </Row>
  147 + )
  148 + })
  149 + }
  150 + <Row>
  151 + <Text>1200</Text>
  152 + <Text>/</Text>
  153 + </Row>
  154 + </Col>
  155 + </Row>
  156 + </Grid>
  157 + </ScrollView>
100 </View> 158 </View>
101 </View> 159 </View>
102 ); 160 );
@@ -171,5 +229,34 @@ const styles = StyleSheet.create({ @@ -171,5 +229,34 @@ const styles = StyleSheet.create({
171 configureContaier: { 229 configureContaier: {
172 backgroundColor: "white", 230 backgroundColor: "white",
173 marginTop: 10 231 marginTop: 10
  232 + },
  233 + tableContainer: {
  234 + marginLeft: 18,
  235 + paddingRight: 18,
  236 + borderStyle: "solid",
  237 + borderColor: "#E8E8E8",
  238 + borderTopWidth: 0.5,
  239 + paddingVertical: 12,
  240 + },
  241 + gridtitleContaier: {
  242 + justifyContent: "center",
  243 + alignItems: "center",
  244 + paddingVertical: 8,
  245 + backgroundColor: "#1B9341",
  246 + borderColor: "#E8E8E8",
  247 + borderStyle: "solid",
  248 + borderLeftWidth: 0.5,
  249 + },
  250 + gridheaderText: {
  251 + fontSize: 11,
  252 + color: "white",
  253 + },
  254 + actor: {
  255 + justifyContent: "center",
  256 + alignItems: "center",
  257 + },
  258 + contentText: {
  259 + fontSize: 12,
  260 + lineHeight: 17,
174 } 261 }
175 }); 262 });
@@ -2605,7 +2605,7 @@ lodash@^3.5.0: @@ -2605,7 +2605,7 @@ lodash@^3.5.0:
2605 version "3.10.1" 2605 version "3.10.1"
2606 resolved "http://registry.npm.taobao.org/lodash/download/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" 2606 resolved "http://registry.npm.taobao.org/lodash/download/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
2607 2607
2608 -lodash@^4.14.0, lodash@^4.16.6, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.6.1: 2608 +lodash@^4.11.1, lodash@^4.14.0, lodash@^4.16.6, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.6.1:
2609 version "4.17.4" 2609 version "4.17.4"
2610 resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" 2610 resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
2611 2611
@@ -3251,6 +3251,12 @@ react-native-drawer-layout@1.3.2: @@ -3251,6 +3251,12 @@ react-native-drawer-layout@1.3.2:
3251 dependencies: 3251 dependencies:
3252 react-native-dismiss-keyboard "1.0.0" 3252 react-native-dismiss-keyboard "1.0.0"
3253 3253
  3254 +react-native-easy-grid@^0.1.15:
  3255 + version "0.1.15"
  3256 + resolved "http://registry.npm.taobao.org/react-native-easy-grid/download/react-native-easy-grid-0.1.15.tgz#02939ae032d74662b50c9540d902c79866ba638a"
  3257 + dependencies:
  3258 + lodash "^4.11.1"
  3259 +
3254 react-native-swiper@^1.5.11: 3260 react-native-swiper@^1.5.11:
3255 version "1.5.11" 3261 version "1.5.11"
3256 resolved "http://registry.npm.taobao.org/react-native-swiper/download/react-native-swiper-1.5.11.tgz#2d46ded43f383dbde4540d513cb4eaaa60eaed61" 3262 resolved "http://registry.npm.taobao.org/react-native-swiper/download/react-native-swiper-1.5.11.tgz#2d46ded43f383dbde4540d513cb4eaaa60eaed61"