GeneralView.js 3.43 KB
Newer Older
Giang Tran committed
1 2 3 4 5 6 7 8 9 10 11
import React, {useState} from 'react';
import {
  View,
  Text,
  Image,
  TouchableOpacity,
  StyleSheet,
  Alert,
  KeyboardAvoidingView,
  ScrollView,
  Platform,
Giang Tran committed
12 13
  TouchableWithoutFeedback,
  Keyboard,
Giang Tran committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
} from 'react-native';
import R from '../../../assets/R';
import moment from 'moment';

import TextField from '../../../components/Input/TextField';
import TextMulti from '../../../components/Input/TextMulti';
import PickerDate from '../../../components/Picker/PickerDate';
import PickerImg from '../../../components/Picker/PickerImg';

import {
  checkFormatArray,
  convertTime,
  convertDate,
  renderStatus,
  getFontXD,
} from '../../../Config/Functions';
import {connect} from 'react-redux';

const GeneralInfor = (props) => {
  return (
    <KeyboardAvoidingView
      behavior={Platform.Os === 'ios' ? 'padding' : 'height'}
      style={{flex: 1}}
      keyboardVerticalOffset={-50}>
Giang Tran committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
      <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
        <ScrollView showsVerticalScrollIndicator={false}>
          <View style={{flex: 1, paddingHorizontal: 10, paddingTop: 10}}>
            <View
              style={{
                width: '100%',
                paddingVertical: 10,
                flexDirection: 'row',
                justifyContent: 'space-between',
                alignItems: 'center',
              }}>
              <View style={{flex: 1}}>
                <Text
                  style={{
                    fontSize: getFontXD(42),
                    color: R.colors.color777,
                    marginBottom: 5,
                  }}>
                  Trng thái
                </Text>
              </View>
              <View style={{flex: 1}}>{renderStatus(props.user.status)}</View>
Giang Tran committed
60
            </View>
Giang Tran committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
            <View style={{flexDirection: 'row'}}>
              <View style={{flex: 1}}>
                <TextField
                  editable={false}
                  value={props.user.l_name}
                  title={'Họ và tên đệm'}
                />
              </View>
              <View style={{width: 20}} />
              <View style={{flex: 1}}>
                <TextField
                  value={props.user.f_name}
                  editable={false}
                  title={'Tên'}
                />
              </View>
Giang Tran committed
77
            </View>
Giang Tran committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
            <TextField
              value={props.user.phone}
              isNumber={true}
              editable={false}
              title={'Số điện thoại'}
            />
            <PickerDate
              valueString={convertDate(props.user.birthday)}
              disabled={true}
              title={'Ngày sinh'}
            />
            <TextMulti
              value={props.user.address}
              editable={false}
              title={'Địa chỉ'}
            />
            <View style={{height: 100}} />
Giang Tran committed
95
          </View>
Giang Tran committed
96 97
        </ScrollView>
      </TouchableWithoutFeedback>
Giang Tran committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
    </KeyboardAvoidingView>
  );
};

const styles = StyleSheet.create({
  btnNext: {
    borderRadius: 30,
    backgroundColor: '#1473E6',
    width: 50,
    height: 50,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 20,
    alignSelf: 'flex-end',
    elevation: 2,
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 1,
    },
    shadowOpacity: 0.15,
    shadowRadius: 1.84,
  },
});

const mapStateToProps = (state) => {
  return {
    user: state.userReducer,
  };
};
export default connect(mapStateToProps, {})(GeneralInfor);