This commit is contained in:
2026-05-23 12:23:47 +08:00
parent 7879cef91e
commit 73fa41007b
6 changed files with 164 additions and 30 deletions

View File

@@ -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('');