import React, { PureComponent } from 'react';
import { TouchableOpacity, Text, View, StyleSheet, Dimensions, Image } from 'react-native';

const totalWidth = Dimensions.get('window').width;
class FlatListItem extends PureComponent {
  onPress = () => {
    this.props.onPressItem(this.props.item.id);
  };

  render() {
    return (
      <TouchableOpacity
        {...this.props}
        style={{ height: 60 }}
        onPress={this.onPress}
      >
        <View style={styles.item}>
          <View style={styles.width50}>
            <Text style={{ color: '#1BB7FF', fontSize: 16 }}>{this.props.item.fangWuZuoLuo}</Text>
          </View>
          <View style={styles.nameView}>
            <Text style={styles.nm}>发布时间：2017/10/27</Text>
            <Text style={styles.nm1}>点击量：5</Text>
          </View>
        </View>
        <View style={{ marginBottom: 10 }}>
          <Text style={styles.rightIcon}>dddd</Text>
          <Image style={styles.rightIcon} source={{ uri: 'right_07' }} />
        </View>

      </TouchableOpacity>
    );
  }
}
const styles = StyleSheet.create({
  row: {
    height: 60,
    borderBottomWidth: 1,
    borderBottomColor: '#ccc',
    flexDirection: 'row',
    alignItems: 'center',
  },
  part: {
    marginLeft: 5,
    flex: 1,
  },
  unColor: {
    color: '#575656',
    marginTop: 8,
    fontSize: 12,
  },
  link: {
    color: '#1BB7FF',
    marginTop: 2,
  },
  ScrollView: {
    flex: 1,
  },
  container: {
    flex: 1,
    marginLeft: 10,
    marginRight: 10,
    flexDirection: 'column',
    backgroundColor: 'white',
  },
  nm: {
    color: '#333',
    fontSize: 12,
  },
  nm1: {
    color: '#333',
    fontSize: 12,
    marginLeft: 30,
  },
  nameView: {
    paddingTop: 2,
    flexDirection: 'row',
    alignItems: 'flex-start',
    marginLeft: 1,
  },
  item: {
    flex: 1,
    height: 60,
    width: totalWidth,
    padding: 1,
    borderBottomWidth: 2,
    borderBottomColor: '#ddd',
    flexDirection: 'column',
    alignItems: 'flex-start',
    justifyContent: 'flex-start',
  },
  width50: {
    marginLeft: 1,
    marginRight: 40,
    alignItems: 'flex-start',
    justifyContent: 'flex-start',
    backgroundColor: 'white',
  },
  rightIcon: {
    position: 'absolute',
    right: -2,
    top: -30,
    height: 15,
    width: 15,
  },

});
export default FlatListItem;
