import { StackScreenProps } from '@react-navigation/stack'; import * as React from 'react'; import { Div, Button, Image, Text, Avatar, Input } from 'react-native-magnus'; import { TextInputMask } from 'react-native-masked-text'; import { ScrollView } from 'react-native-gesture-handler'; import ImagePicker from '../components/ImagePicker'; import { useTranslation } from 'react-i18next'; import { useMap, useCreation, useRequest } from 'ahooks'; import { connect } from '../utils/SystemUtils'; import useModel from 'flooks'; import Login from './model'; export default function CertificationScreen({ navigation }: StackScreenProps) { const { t } = useTranslation(); const { data } = useRequest('/verified/my'); const [realName, setRealName] = React.useState(''); const [idNo, setIdNo] = React.useState(''); const [idNoImgMap, idNoImgMapEvent] = useMap([ ['证件正面', ''], ['证件反面', ''], ]); const [handheldIdNo, setHandheldIdNo] = React.useState(''); const { verifiedSave } = useModel(Login, []); const canSubmit = useCreation(() => { if ( realName && idNo && handheldIdNo && idNoImgMapEvent.get('证件正面') !== '' && idNoImgMapEvent.get('证件反面') !== '' ) { return true; } else { return false; } }, [realName, idNo, idNoImgMap, handheldIdNo]); React.useEffect(() => { if (data && data.id) { setRealName(data.realName); setIdNo(data.idNo); setHandheldIdNo(data.handheldIdNo); idNoImgMapEvent.setAll([ ['证件正面', data.idNoImg.split(',')[0]], ['证件反面', data.idNoImg.split(',')[1]], ]); } }, [data]); return (
{t('zhen-shi-xing-ming')}:
{ setRealName(text); }} style={{ flex: 1 }} />
{t('shen-fen-zheng-hao')}:
{ setIdNo(text); }} placeholderTextColor="#a6a6a6" style={{ flex: 1, fontSize: 12, height: 31 }} placeholder={t('shu-ru-zheng-jian-hao-ma')} />
{t('shen-fen-zheng-zheng-fan-mian')}:
{[...idNoImgMap.keys()].map((item, index) => { return (
idNoImgMapEvent.set(item, img)} /> {item}
); })}
{t('shou-chi-shen-fen-zheng')}:
setHandheldIdNo(img)} />
); }