import React, {Component} from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  StyleSheet,
  Image,
  FlatList,
} from 'react-native';
import FastImage from 'react-native-fast-image';
import Icon from 'react-native-vector-icons/FontAwesome5';
import {colors} from '../../assets/styles/colors-theme';
import {Fonts} from '../../assets/styles/fonts-theme';
import history from '../../common/history';
import LoadingView from '../../common/loading';
import NaviBar from '../../components/navi-bar';
import {scale, verticalScale, moderateScale} from 'react-native-size-matters';
import Migrations from '../../services/realm/Mirgrations';
import {inject, observer} from 'mobx-react';
import {width, height} from '../../common/screen';

export default class NewsList extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <TouchableOpacity onPress={this.props.onPress && this.props.onPress}>
        <View
          style={{
            flex: 1,
            marginTop: 10,
            borderBottomWidth: 1,
            borderBottomColor: colors.line2Color,

            flexDirection: 'row',
          }}>
          <Image
            style={{width: 110, height: 70, marginBottom: 10}}
            source={{
              uri: this.props.items.image,
            }}
          />

          <View
            style={{
              flex: 1,
              marginLeft: 5,
              justifyContent: 'space-between',
            }}>
            <Text
              style={{fontFamily: Fonts.ubuntu, fontSize: 17, marginRight: 5}}>
              {this.props.items.title}
            </Text>
            <Text
              style={{
                fontFamily: Fonts.ubuntu,
                fontSize: 13,
                color: colors.textColor,
                marginBottom: 10,
              }}>
              {this.props.date}
            </Text>
          </View>
        </View>
      </TouchableOpacity>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  button: {
    borderWidth: 1,
    borderColor: '#000000',
    margin: 5,
    padding: 5,
    width: '70%',
    backgroundColor: '#DDDDDD',
    borderRadius: 5,
  },
  textField: {
    borderWidth: 1,
    borderColor: '#AAAAAA',
    margin: 5,
    padding: 5,
    width: '70%',
  },
  spacer: {
    height: 10,
  },
  title: {
    fontWeight: 'bold',
    fontSize: 20,
    textAlign: 'center',
  },
});
