import * as WebBrowser from 'expo-web-browser'; import * as React from 'react'; import { Div, Image, Text, Avatar, Input, Button } from 'react-native-magnus'; import { Toast } from '@ant-design/react-native'; import { useInterval } from 'ahooks'; import { sendSms } from '../Utils/SmsUtil'; export default function SmsInput({ labelWidth, phone, onCodeChange, type }) { const [code, setCode] = React.useState(); const [interval, setInterval] = React.useState(null); const [count, setCount] = React.useState(60); useInterval( () => { setCount(count - 1); if (count === 0) { setInterval(null); } }, interval, { immediate: true } ); return (
验证码 { setCode(value); onCodeChange(value); }} />
); }