Showing
2 changed files
with
111 additions
and
19 deletions
| @@ -26,10 +26,10 @@ class NewsList extends Component { | @@ -26,10 +26,10 @@ class NewsList extends Component { | ||
| 26 | render() { | 26 | render() { |
| 27 | return ( | 27 | return ( |
| 28 | <ScrollView style={styles.scrollViewContainer} automaticallyAdjustContentInsets={false}> | 28 | <ScrollView style={styles.scrollViewContainer} automaticallyAdjustContentInsets={false}> |
| 29 | - <ListItem title={"平安保险2017版平安保险平安保险平安保险"} context={"刚刚"} /> | 29 | + <ListItem title={"平安保险2017版平安保险平安保险平安保险"} content={"刚刚"} /> |
| 30 | - <ListItem title={"平安保险2017版"} context={"刚刚"} /> | 30 | + <ListItem title={"平安保险2017版"} content={"刚刚"} /> |
| 31 | - <ListItem title={"平安保险2017版平安保险平安保险平安保平安保险2017版平安保险平安保险平安保险平安保险平安保险平安保险2017版平安保险平安保险平安保险平安保险平安保险险平安保险平安保险"} context={"刚刚"} /> | 31 | + <ListItem title={"平安保险2017版平安保险平安保险平安保平安保险2017版平安保险平安保险平安保险平安保险平安保险平安保险2017版平安保险平安保险平安保险平安保险平安保险险平安保险平安保险"} content={"刚刚"} /> |
| 32 | - <ListItem title={"平安保险2017版"} context={"刚刚"} /> | 32 | + <ListItem title={"平安保险2017版"} content={"刚刚"} /> |
| 33 | <Text style={styles.scrollViewText}>没有更多了</Text> | 33 | <Text style={styles.scrollViewText}>没有更多了</Text> |
| 34 | </ScrollView> | 34 | </ScrollView> |
| 35 | ); | 35 | ); |
| @@ -43,7 +43,7 @@ class ListItem extends Component { | @@ -43,7 +43,7 @@ class ListItem extends Component { | ||
| 43 | <View style={styles.itemImgWrapper}></View> | 43 | <View style={styles.itemImgWrapper}></View> |
| 44 | <View style={styles.itemRightWrapper}> | 44 | <View style={styles.itemRightWrapper}> |
| 45 | <Text style={styles.itemTextTop} numberOfLines={2}>{this.props.title}</Text> | 45 | <Text style={styles.itemTextTop} numberOfLines={2}>{this.props.title}</Text> |
| 46 | - <Text style={styles.itemTextBottom}>{this.props.context}</Text> | 46 | + <Text style={styles.itemTextBottom}>{this.props.content}</Text> |
| 47 | </View> | 47 | </View> |
| 48 | </TouchableOpacity> | 48 | </TouchableOpacity> |
| 49 | ) | 49 | ) |
| @@ -4,34 +4,126 @@ import { | @@ -4,34 +4,126 @@ import { | ||
| 4 | AppRegistry, | 4 | AppRegistry, |
| 5 | StyleSheet, | 5 | StyleSheet, |
| 6 | Text, | 6 | Text, |
| 7 | - View | 7 | + View, |
| 8 | + ScrollView, | ||
| 9 | + TouchableOpacity, | ||
| 10 | + Image | ||
| 8 | } from 'react-native'; | 11 | } from 'react-native'; |
| 9 | 12 | ||
| 10 | - | ||
| 11 | - | ||
| 12 | export default class InsuranceCircle extends Component { | 13 | export default class InsuranceCircle extends Component { |
| 13 | render() { | 14 | render() { |
| 14 | return ( | 15 | return ( |
| 15 | <View style={styles.container}> | 16 | <View style={styles.container}> |
| 16 | - <Text style={styles.welcome}> | 17 | + <NewsList /> |
| 17 | - 保圈 | ||
| 18 | - </Text> | ||
| 19 | </View> | 18 | </View> |
| 20 | ); | 19 | ); |
| 21 | } | 20 | } |
| 22 | } | 21 | } |
| 23 | 22 | ||
| 23 | +class NewsList extends Component { | ||
| 24 | + render() { | ||
| 25 | + return ( | ||
| 26 | + <ScrollView style={styles.scrollViewContainer} automaticallyAdjustContentInsets={false}> | ||
| 27 | + <ListItem | ||
| 28 | + title={"家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…"} | ||
| 29 | + content={"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…"} | ||
| 30 | + name={"汉克斯"} | ||
| 31 | + num={"30"} | ||
| 32 | + /> | ||
| 33 | + <ListItem | ||
| 34 | + title={"家庭经济越差越应该买保险,因为你病不起,输不起,也折腾不起…"} | ||
| 35 | + content={"现实生活就是如此矛盾现实生活,就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实生活就是如此矛盾现实矛是如此此…"} | ||
| 36 | + name={"汉克斯"} | ||
| 37 | + num={"30"} | ||
| 38 | + /> | ||
| 39 | + <Text style={styles.scrollViewText}>没有更多了</Text> | ||
| 40 | + </ScrollView> | ||
| 41 | + ) | ||
| 42 | + } | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +class ListItem extends Component { | ||
| 46 | + render() { | ||
| 47 | + return ( | ||
| 48 | + <TouchableOpacity style={styles.itemContainer}> | ||
| 49 | + <Text style={styles.itemTitle} numberOfLines={2}>{this.props.title}</Text> | ||
| 50 | + <Text style={styles.itemContent} numberOfLines={3}>{this.props.content}</Text> | ||
| 51 | + <View style={styles.itemInfoWrapper}> | ||
| 52 | + <View style={styles.itemInfoLeft}> | ||
| 53 | + {/* <Image style={styles.itemInfoIcon} /> */} | ||
| 54 | + <View style={styles.itemInfoIcon}></View> | ||
| 55 | + <Text style={styles.itemInfoName}>{this.props.name}</Text> | ||
| 56 | + </View> | ||
| 57 | + <Text style={styles.itemInfoRight}>{this.props.num} 评论</Text> | ||
| 58 | + </View> | ||
| 59 | + </TouchableOpacity> | ||
| 60 | + ) | ||
| 61 | + } | ||
| 62 | +} | ||
| 63 | + | ||
| 24 | const styles = StyleSheet.create({ | 64 | const styles = StyleSheet.create({ |
| 25 | container: { | 65 | container: { |
| 26 | flex: 1, | 66 | flex: 1, |
| 27 | - justifyContent: 'center', | 67 | + justifyContent: "flex-start", |
| 28 | - alignItems: 'center', | 68 | + alignItems: "stretch", |
| 29 | - backgroundColor: '#F5FCFF', | 69 | + backgroundColor: "#EFEFEF", |
| 70 | + paddingTop: 74, | ||
| 71 | + }, | ||
| 72 | + scrollViewContainer: { | ||
| 73 | + height: 300, | ||
| 74 | + }, | ||
| 75 | + scrollViewText: { | ||
| 76 | + color: "#7A7A7A", | ||
| 77 | + fontSize: 13, | ||
| 78 | + marginTop: 10, | ||
| 79 | + textAlign: "center" | ||
| 80 | + }, | ||
| 81 | + itemContainer: { | ||
| 82 | + backgroundColor: "#fff", | ||
| 83 | + marginBottom: 10, | ||
| 84 | + height: 180, | ||
| 85 | + paddingLeft: 13, | ||
| 86 | + paddingRight: 13, | ||
| 87 | + paddingTop: 19, | ||
| 88 | + }, | ||
| 89 | + itemTitle: { | ||
| 90 | + fontSize: 17, | ||
| 91 | + color: "#242424", | ||
| 92 | + lineHeight: 24 | ||
| 93 | + }, | ||
| 94 | + itemContent: { | ||
| 95 | + marginTop: 5, | ||
| 96 | + fontSize: 14, | ||
| 97 | + color: "#7A7A7A", | ||
| 98 | + lineHeight: 20 | ||
| 99 | + }, | ||
| 100 | + itemInfoWrapper: { | ||
| 101 | + flexDirection: "row", | ||
| 102 | + justifyContent: "space-between", | ||
| 103 | + alignItems: "center", | ||
| 104 | + marginTop: 11 | ||
| 105 | + }, | ||
| 106 | + itemInfoLeft: { | ||
| 107 | + flexDirection: "row", | ||
| 108 | + justifyContent: "flex-start", | ||
| 109 | + alignItems: "center", | ||
| 110 | + }, | ||
| 111 | + itemInfoIcon: { | ||
| 112 | + width: 26, | ||
| 113 | + height: 26, | ||
| 114 | + backgroundColor: "#ccc", | ||
| 115 | + marginRight: 10, | ||
| 116 | + borderRadius: 26, | ||
| 117 | + }, | ||
| 118 | + itemInfoName: { | ||
| 119 | + fontSize: 13, | ||
| 120 | + color: "#242424", | ||
| 121 | + lineHeight: 18, | ||
| 30 | }, | 122 | }, |
| 31 | - welcome: { | 123 | + itemInfoRight: { |
| 32 | - fontSize: 20, | 124 | + fontSize: 13, |
| 33 | - textAlign: 'center', | 125 | + color: "#999999", |
| 34 | - margin: 10, | 126 | + lineHeight: 18, |
| 35 | }, | 127 | }, |
| 36 | -}); | 128 | +}) |
| 37 | 129 |
-
Please register or login to post a comment