Item.js 2.4 KB
Newer Older
Giang Tran committed
1
import React from 'react';
Giang Tran committed
2 3
import {View, Text, StyleSheet, TouchableOpacity, Image} from 'react-native';
import {getFontXD, HEIGHTXD, WIDTHXD} from '../../../Config/Functions';
Giang Tran committed
4 5 6 7
import R from '../../../assets/R';
import Block from '../../../components/Block';

const Item = (props) => {
Giang Tran committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
  const {item, isEndItem} = props;
  return (
    <View
      style={[styles.container, isEndItem && {marginBottom: HEIGHTXD(100)}]}>
      <TouchableOpacity onPress={() => props.onPress(item)}>
        <Block flex={1} row>
          <View style={styles.wrapDate}>
            <Image source={{uri: item.image_path}} style={styles.imgIcon} />
          </View>
          <Block padding={[0, 10]} flex={1}>
            <View
              style={{
                flexDirection: 'row',
              }}>
              <Text
                numberOfLines={2}
                style={[styles.txtBlack, {flexWrap: 'wrap', flex: 1}]}
                numberOfLines={1}
                ellipsizeMode="tail">
                {item.name}
              </Text>
              <Text style={styles.txtMoney}>{item.trans_time}</Text>
            </View>
            {item.trans_session_list.map((sessionItem) => (
              <Text style={[styles.txt, {marginTop: HEIGHTXD(20)}]}>
                {sessionItem}
              </Text>
            ))}
          </Block>
        </Block>
      </TouchableOpacity>
    </View>
  );
Giang Tran committed
41 42 43 44 45
};

export default Item;

const styles = StyleSheet.create({
Giang Tran committed
46 47 48 49 50 51
  container: {
    paddingVertical: HEIGHTXD(30),
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2,
Giang Tran committed
52
    },
Giang Tran committed
53 54 55 56 57 58 59 60
    shadowOpacity: 0.25,
    shadowRadius: 3.84,
    elevation: 5,
    marginHorizontal: 10,
    backgroundColor: R.colors.white,
    borderRadius: HEIGHTXD(30),
    marginVertical: HEIGHTXD(15),
  },
Giang Tran committed
61

Giang Tran committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
  wrapLeft: {
    width: WIDTHXD(16),
    borderTopLeftRadius: HEIGHTXD(30),
    borderBottomStartRadius: HEIGHTXD(30),
  },
  wrapDate: {
    justifyContent: 'center',
    paddingLeft: 10,
  },
  txtTitle: {
    fontSize: getFontXD(42),
    color: R.colors.black,
  },
  txt: {
    fontSize: getFontXD(36),
  },
  rowBet: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
  txtBlack: {
    fontSize: getFontXD(46),
    color: 'black',
  },
  imgIcon: {
    width: WIDTHXD(178),
    height: WIDTHXD(178),
    resizeMode: 'cover',
  },
  txtMoney: {
    fontSize: getFontXD(42),
    color: R.colors.main,
  },
Giang Tran committed
96
});