Hi, I am working on a react native project. I have a screen which captures the user’s mobile number and redirects the user to the OTP screen. In the OTP screen, I want the OTP to be sent to the entered phone number. However, when attemptInvisibleVerification is set to true, then the OTP is not sent in the SendOTP function which is called in UseEffect. When I debug, the debug pointer gets struck at verifyPhoneNumber method.
<FirebaseRecaptcha.FirebaseRecaptchaVerifierModal
ref={recaptchaVerifier}
firebaseConfig={firebaseConfig}
attemptInvisibleVerification={true}
/>
async function sendOTP() {
const phoneProvider = new PhoneAuthProvider(auth);
try {
const recap = recaptchaVerifier.current;
const verificationId = await phoneProvider.verifyPhoneNumber(
'+91 ’ + enteredMobileNumber,
recap
);
setVerificationId(verificationId);
} catch (error) {
console.error(error);
}
}