InputMoney.js 1.66 KB
Newer Older
Giang Tran committed
1 2 3 4 5 6 7
import React from 'react';
import {View, Text, TextInput} from 'react-native';
import {HEIGHTXD, WIDTHXD, getFontXD} from '../../Config/Functions';
import R from '../../assets/R';
import {toPriceVnd} from '../../Config/Functions';

const TextMoney = (props) => {
Giang Tran committed
8 9 10 11 12 13 14 15 16
  const {
    title,
    onChangeText,
    maxLength,
    value,
    editable,
    titleStyle,
    inputStyle,
  } = props;
Giang Tran committed
17 18 19 20

  return (
    <View style={{marginVertical: 5}}>
      <Text
Giang Tran committed
21 22 23 24 25 26 27 28
        style={[
          {
            fontSize: getFontXD(42),
            color: R.colors.color777,
            marginBottom: 5,
          },
          titleStyle && titleStyle,
        ]}>
Giang Tran committed
29 30 31 32 33 34 35 36 37 38
        {title ? title : ''}
      </Text>
      <TextInput
        maxLength={maxLength ? maxLength : 256}
        placeholderTextColor={R.colors.placeHolder}
        editable={editable != null ? editable : true}
        autoCapitalize="none"
        value={toPriceVnd(value)}
        keyboardType={'number-pad'}
        onChangeText={(val) => onChangeText(val.split(',').join(''))}
Giang Tran committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
        style={[
          {
            height: HEIGHTXD(109),
            color: 'black',
            borderRadius: 7,
            borderWidth: 0.7,
            borderColor: '#DBDBDB',
            fontSize: getFontXD(42),
            paddingVertical: 5,
            paddingHorizontal: 10,
            backgroundColor: 'white',
            shadowColor: '#AFA9A9',
            shadowOffset: {
              width: 0,
              height: 1,
            },
            shadowOpacity: 0.25,
            shadowRadius: 1.84,
            elevation: 1,
Giang Tran committed
58
          },
Giang Tran committed
59 60
          inputStyle && inputStyle,
        ]}
Giang Tran committed
61 62 63 64 65 66
      />
    </View>
  );
};

export default React.memo(TextMoney);