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

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

  return (
    <View style={{marginVertical: 5}}>
      <Text
        style={{
          fontSize: getFontXD(42),
          color: R.colors.color777,
          marginBottom: 5,
        }}>
        {title ? title : ''}
      </Text>
      <TextInput
Giang Tran committed
20
        maxLength={maxLength ? maxLength : 256}
Giang Tran committed
21
        placeholderTextColor={R.colors.placeHolder}
Giang Tran committed
22
        editable={editable != null ? editable : true}
Giang Tran committed
23
        autoCapitalize="none"
Giang Tran committed
24 25
        value={value}
        keyboardType={isNumber ? 'number-pad' : 'default'}
Giang Tran committed
26
        onChangeText={(val) => onChangeText(val)}
Giang Tran committed
27 28
        style={{
          height: HEIGHTXD(109),
Giang Tran committed
29
          color: 'black',
Giang Tran committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
          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,
        }}
      />
    </View>
  );
};

Giang Tran committed
51
export default React.memo(TextField);