Item.js 2.47 KB
Newer Older
Giang Tran committed
1 2
import React from 'react';
import {
Giang Tran committed
3 4 5 6 7 8
  View,
  Text,
  StyleSheet,
  TouchableOpacity,
  Image,
  Alert,
Giang Tran committed
9 10
} from 'react-native';
import {
Giang Tran committed
11 12 13 14
  getFontXD,
  HEIGHTXD,
  WIDTHXD,
  toPriceVnd,
Giang Tran committed
15 16 17
} from '../../../Config/Functions';
import R from '../../../assets/R';
import Block from '../../../components/Block';
Giang Tran committed
18
import I18n from '../../../helper/i18/i18n';
Giang Tran committed
19 20

const Item = (props) => {
Nguyễn Thị Thúy committed
21
  const {item, isEndItem} = props;
Giang Tran committed
22
  console.log('sss', item);
Giang Tran committed
23
  return (
Giang Tran committed
24 25
    <View
      style={[styles.container, isEndItem && {marginBottom: HEIGHTXD(100)}]}>
Giang Tran committed
26 27
      <TouchableOpacity onPress={() => props.onPress(item)}>
        <Block flex={1} row>
Giang Tran committed
28
          <Image source={{uri: item.image_path}} style={styles.imgIcon} />
Nguyễn Thị Thúy committed
29
          <Block padding={[0, WIDTHXD(40)]} space={'between'} flex={1}>
Giang Tran committed
30 31 32 33
            <View
              style={{
                flexDirection: 'row',
              }}>
Giang Tran committed
34 35 36 37 38
              <Text
                numberOfLines={2}
                style={[styles.txtBlack, {flexWrap: 'wrap', flex: 1}]}
                numberOfLines={1}
                ellipsizeMode="tail">
Nguyễn Thị Thúy committed
39
                {item.name}
Giang Tran committed
40
              </Text>
Nguyễn Thị Thúy committed
41
              <Text style={styles.txtMoney}>{toPriceVnd(item.fee)}</Text>
Giang Tran committed
42
            </View>
Giang Tran committed
43 44 45 46
            <Text style={styles.txt}>
              {I18n.t('code')}: {item.code}
            </Text>
            <Text style={styles.txt}>{item.category.name}</Text>
Giang Tran committed
47 48 49 50 51
          </Block>
        </Block>
      </TouchableOpacity>
    </View>
  );
Giang Tran committed
52 53 54 55 56
};

export default Item;

const styles = StyleSheet.create({
Giang Tran committed
57
  container: {
Nguyễn Thị Thúy committed
58
    paddingVertical: HEIGHTXD(40),
Giang Tran committed
59 60 61 62
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 2,
Giang Tran committed
63
    },
Giang Tran committed
64 65 66 67 68
    shadowOpacity: 0.25,
    shadowRadius: 3.84,
    elevation: 5,
    backgroundColor: R.colors.white,
    borderRadius: HEIGHTXD(30),
Nguyễn Thị Thúy committed
69
    marginVertical: HEIGHTXD(15),
Giang Tran committed
70
    marginHorizontal: WIDTHXD(30),
Giang Tran committed
71
  },
Giang Tran committed
72

Giang Tran committed
73 74 75 76 77 78 79 80 81 82 83
  wrapLeft: {
    width: WIDTHXD(16),
    borderTopLeftRadius: HEIGHTXD(30),
    borderBottomStartRadius: HEIGHTXD(30),
  },
  txtTitle: {
    fontSize: getFontXD(42),
    color: R.colors.black,
    fontWeight: 'bold',
  },
  txt: {
Nguyễn Thị Thúy committed
84 85
    fontSize: getFontXD(36),
    color: 'black',
Giang Tran committed
86 87 88 89 90 91 92
  },
  rowBet: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
  txtBlack: {
Giang Tran committed
93
    fontSize: getFontXD(46),
Giang Tran committed
94 95 96
    color: 'black',
  },
  imgIcon: {
Giang Tran committed
97 98
    width: WIDTHXD(178),
    height: WIDTHXD(178),
99
    resizeMode: 'cover',
Giang Tran committed
100
    marginLeft: WIDTHXD(35),
Giang Tran committed
101 102 103 104 105
  },
  txtMoney: {
    fontSize: getFontXD(42),
    color: R.colors.main,
  },
Giang Tran committed
106
});