Showing
1 changed file
with
80 additions
and
12 deletions
| @@ -4,7 +4,10 @@ import { | @@ -4,7 +4,10 @@ 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 | 13 | ||
| @@ -13,25 +16,90 @@ export default class InsuranceChurch extends Component { | @@ -13,25 +16,90 @@ export default class InsuranceChurch extends Component { | ||
| 13 | render() { | 16 | render() { |
| 14 | return ( | 17 | return ( |
| 15 | <View style={styles.container}> | 18 | <View style={styles.container}> |
| 16 | - <Text style={styles.welcome}> | 19 | + <NewsList /> |
| 17 | - 保堂 | ||
| 18 | - </Text> | ||
| 19 | </View> | 20 | </View> |
| 20 | ); | 21 | ); |
| 21 | } | 22 | } |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 25 | +class NewsList extends Component { | ||
| 26 | + render() { | ||
| 27 | + return ( | ||
| 28 | + <ScrollView style={styles.scrollViewContainer} automaticallyAdjustContentInsets={false}> | ||
| 29 | + <ListItem title={"平安保险2017版平安保险平安保险平安保险"} context={"刚刚"} /> | ||
| 30 | + <ListItem title={"平安保险2017版"} context={"刚刚"} /> | ||
| 31 | + <ListItem title={"平安保险2017版平安保险平安保险平安保平安保险2017版平安保险平安保险平安保险平安保险平安保险平安保险2017版平安保险平安保险平安保险平安保险平安保险险平安保险平安保险"} context={"刚刚"} /> | ||
| 32 | + <ListItem title={"平安保险2017版"} context={"刚刚"} /> | ||
| 33 | + <Text style={styles.scrollViewText}>没有更多了</Text> | ||
| 34 | + </ScrollView> | ||
| 35 | + ); | ||
| 36 | + } | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +class ListItem extends Component { | ||
| 40 | + render() { | ||
| 41 | + return ( | ||
| 42 | + <TouchableOpacity style={styles.itemContainer}> | ||
| 43 | + <View style={styles.itemImgWrapper}></View> | ||
| 44 | + <View style={styles.itemRightWrapper}> | ||
| 45 | + <Text style={styles.itemTextTop} numberOfLines={2}>{this.props.title}</Text> | ||
| 46 | + <Text style={styles.itemTextBottom}>{this.props.context}</Text> | ||
| 47 | + </View> | ||
| 48 | + </TouchableOpacity> | ||
| 49 | + ) | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | + | ||
| 24 | const styles = StyleSheet.create({ | 53 | const styles = StyleSheet.create({ |
| 25 | container: { | 54 | container: { |
| 26 | flex: 1, | 55 | flex: 1, |
| 27 | - justifyContent: 'center', | 56 | + justifyContent: "flex-start", |
| 28 | - alignItems: 'center', | 57 | + alignItems: "stretch", |
| 29 | - backgroundColor: '#F5FCFF', | 58 | + backgroundColor: "#EFEFEF", |
| 30 | - }, | 59 | + paddingTop: 74 |
| 31 | - welcome: { | 60 | + }, |
| 32 | - fontSize: 20, | 61 | + scrollViewContainer: { |
| 33 | - textAlign: 'center', | 62 | + height: 300, |
| 34 | - margin: 10, | 63 | + // backgroundColor: "red" |
| 64 | + }, | ||
| 65 | + scrollViewText: { | ||
| 66 | + color: "#7A7A7A", | ||
| 67 | + fontSize: 13, | ||
| 68 | + marginTop: 10, | ||
| 69 | + textAlign: "center" | ||
| 70 | + }, | ||
| 71 | + itemContainer: { | ||
| 72 | + height: 102, | ||
| 73 | + backgroundColor: "#fff", | ||
| 74 | + flexDirection: 'row', | ||
| 75 | + alignItems: "center", | ||
| 76 | + borderTopWidth: 1, | ||
| 77 | + borderTopColor: "#EEEEEE", | ||
| 78 | + borderStyle: "solid", | ||
| 79 | + paddingLeft: 13, | ||
| 80 | + paddingRight: 13, | ||
| 81 | + }, | ||
| 82 | + itemImgWrapper: { | ||
| 83 | + width:88, | ||
| 84 | + height:78, | ||
| 85 | + backgroundColor: "#ccc", | ||
| 86 | + marginRight: 12 | ||
| 87 | + }, | ||
| 88 | + itemRightWrapper: { | ||
| 89 | + justifyContent: "center", | ||
| 90 | + height: 66, | ||
| 91 | + flex: 1 | ||
| 92 | + // marginRight: 13 | ||
| 93 | + }, | ||
| 94 | + itemTextTop: { | ||
| 95 | + fontSize: 16, | ||
| 96 | + color: "#202020", | ||
| 97 | + lineHeight: 21 | ||
| 98 | + }, | ||
| 99 | + itemTextBottom: { | ||
| 100 | + fontSize: 13, | ||
| 101 | + color: "#7A7A7A", | ||
| 102 | + lineHeight: 18 | ||
| 35 | }, | 103 | }, |
| 36 | }); | 104 | }); |
| 37 | 105 |
-
Please register or login to post a comment