import * as WebBrowser from 'expo-web-browser'; import * as React from 'react'; import { Div, Image, Text, Avatar, Input, Button } from 'react-native-magnus'; import { TextInputMask } from 'react-native-masked-text'; import { useTranslation } from 'react-i18next'; import { useInterval } from 'ahooks'; import { sendSms } from '../utils/SmsUtil'; import { toastInfo } from '../utils/SystemUtils'; export default function SmsInput({ phone, onCodeChange, type }) { const [code, setCode] = React.useState(); const [interval, setInterval] = React.useState(null); const [count, setCount] = React.useState(60); const { t } = useTranslation(); useInterval( () => { setCount(count - 1); if (count === 0) { setInterval(null); } }, interval, { immediate: true } ); return (
验证码
{ setCode(text); onCodeChange(text); }} placeholderTextColor="#a6a6a6" style={{ flex: 1, fontSize: 14 }} placeholder={t('shu-ru-yan-zheng-ma')} />
); }