罗广聪

首页静态OK

  1 +/**
  2 + * Sample React Native App
  3 + * https://github.com/facebook/react-native
  4 + * @flow
  5 + */
  6 +
  7 +import React, { Component } from "react";
  8 +import { AppRegistry, StyleSheet, Text, View, TouchableOpacity, Image, ScrollView } from "react-native";
  9 +
  10 +export default class NewsList extends Component {
  11 + render() {
  12 + return (
  13 + <ScrollView style={styles.container} automaticallyAdjustContentInsets={false}>
  14 + <ListItem title={"平安保险2017版"} context={"600万医疗报废,自费药,进口药,器材费"} />
  15 + <ListItem title={"平安保险2017版"} context={"600万医疗报废,自费药,进口药,器材费"} />
  16 + <ListItem title={"平安保险2017版"} context={"600万医疗报废,自费药,进口药,器材费"} />
  17 + <ListItem title={"平安保险2017版"} context={"600万医疗报废,自费药,进口药,器材费"} />
  18 + </ScrollView>
  19 + );
  20 + }
  21 +}
  22 +
  23 +class ListItem extends Component {
  24 + render() {
  25 + return (
  26 + <TouchableOpacity style={styles.itemContainer}>
  27 + <View style={styles.itemImgWrapper}></View>
  28 + <View style={styles.itemRightWrapper}>
  29 + <Text style={styles.itemTextTop}>{this.props.title}</Text>
  30 + <Text style={styles.itemTextBottom}>{this.props.context}</Text>
  31 + </View>
  32 + </TouchableOpacity>
  33 + )
  34 + }
  35 +}
  36 +
  37 +const styles = StyleSheet.create({
  38 + container: {
  39 + height:150,
  40 + },
  41 + itemContainer: {
  42 + height: 90,
  43 + backgroundColor: "#fff",
  44 + flexDirection: 'row',
  45 + alignItems: "center",
  46 + borderTopWidth: 1,
  47 + borderTopColor: "#EEEEEE",
  48 + borderStyle: "solid",
  49 + paddingLeft: 13,
  50 + paddingRight: 13,
  51 + },
  52 + itemImgWrapper: {
  53 + width:74,
  54 + height:66,
  55 + backgroundColor: "#ccc",
  56 + marginRight: 12
  57 + },
  58 + itemRightWrapper: {
  59 + justifyContent: "center",
  60 + height: 66,
  61 + flex: 1
  62 + // marginRight: 13
  63 + },
  64 + itemTextTop: {
  65 + fontSize: 16,
  66 + color: "#202020",
  67 + lineHeight: 21
  68 + },
  69 + itemTextBottom: {
  70 + fontSize: 13,
  71 + color: "#7A7A7A",
  72 + lineHeight: 18
  73 + },
  74 +});
1 import React, { Component } from "react"; 1 import React, { Component } from "react";
2 import { AppRegistry, StyleSheet, Text, View, Image, TouchableOpacity } from "react-native"; 2 import { AppRegistry, StyleSheet, Text, View, Image, TouchableOpacity } from "react-native";
3 import Carousel from "../../Components/Carousel"; 3 import Carousel from "../../Components/Carousel";
  4 +import NewsList from "./NewList";
4 5
5 export default class Main extends Component { 6 export default class Main extends Component {
6 7
@@ -12,22 +13,19 @@ export default class Main extends Component { @@ -12,22 +13,19 @@ export default class Main extends Component {
12 return ( 13 return (
13 <View style={styles.container}> 14 <View style={styles.container}>
14 <Carousel /> 15 <Carousel />
15 - {/* <Text style={styles.welcome}>首页</Text> */} 16 + <TouchableOpacity style={styles.midContainer}>
16 - <TouchableOpacity onPress={() => {this.props.navigator.push()}} style={styles.midContainer}>  
17 <Image source={require('../../assets/首页的副本/pic.png')} style={{width:72, height:18}} /> 17 <Image source={require('../../assets/首页的副本/pic.png')} style={{width:72, height:18}} />
18 <Text style={styles.midText}>平安保险2017</Text> 18 <Text style={styles.midText}>平安保险2017</Text>
19 </TouchableOpacity> 19 </TouchableOpacity>
20 <View style={styles.textContainer}> 20 <View style={styles.textContainer}>
21 - <Text>保险头条</Text> 21 + <Text style={styles.minText}>保险头条</Text>
22 </View> 22 </View>
  23 + <NewsList />
23 </View> 24 </View>
24 ); 25 );
25 } 26 }
26 } 27 }
27 28
28 -  
29 -// this.props.navigator.push()  
30 -  
31 const styles = StyleSheet.create({ 29 const styles = StyleSheet.create({
32 container: { 30 container: {
33 flex: 1, 31 flex: 1,
@@ -35,7 +33,6 @@ const styles = StyleSheet.create({ @@ -35,7 +33,6 @@ const styles = StyleSheet.create({
35 justifyContent: "flex-start", 33 justifyContent: "flex-start",
36 alignItems: "stretch", 34 alignItems: "stretch",
37 backgroundColor: "#EFEFEF" 35 backgroundColor: "#EFEFEF"
38 -  
39 }, 36 },
40 midContainer: { 37 midContainer: {
41 height: 45, 38 height: 45,
@@ -58,7 +55,7 @@ const styles = StyleSheet.create({ @@ -58,7 +55,7 @@ const styles = StyleSheet.create({
58 height: 45, 55 height: 45,
59 justifyContent: "center", 56 justifyContent: "center",
60 paddingLeft: 13, 57 paddingLeft: 13,
61 - fontSize: 15, 58 + // fontSize: 15,
62 - color: "#202020", 59 + // color: "#202020",
63 } 60 }
64 }); 61 });