优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { WalletType } from 'rnwalletman';
|
||||
|
||||
export interface OTPBindCallbacks {
|
||||
@@ -34,6 +34,7 @@ export function useOTPBind(
|
||||
otpLength?: number;
|
||||
mobileLength?: number;
|
||||
additionalParams?: any;
|
||||
initialMobile?: string;
|
||||
}
|
||||
): [OTPBindState, OTPBindActions] {
|
||||
const [mobile, setMobile] = useState('');
|
||||
@@ -44,7 +45,11 @@ export function useOTPBind(
|
||||
const [errorMessage, setErrorMessage] = useState('');
|
||||
|
||||
const { onRequestOTP, onVerifyOTP, onSuccess, onError, isDebug = false } = callbacks;
|
||||
const { otpLength = 6, mobileLength = 10, additionalParams = {} } = config || {};
|
||||
const { otpLength = 6, mobileLength = 10, additionalParams = {}, initialMobile = '' } = config || {};
|
||||
|
||||
useEffect(() => {
|
||||
if (initialMobile) setMobile(initialMobile);
|
||||
}, [initialMobile]);
|
||||
|
||||
const clearError = () => setErrorMessage('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user