Estoy tratando de agregar Firebase Auth a mi aplicación móvil usando este enlace para admitir la autenticación de número de teléfono.
Una versión mínima de mi código es
import React, { useState } from "react"; import { Text, View, Image, ImageBackground, TouchableOpacity, TextInput } from "react-native"; import Firebase from '../config/firebase'; import { getAuth, signInWithPhoneNumber, RecaptchaVerifier } from "firebase/auth"; const WelcomeScreen = ({ navigation }) => { function continueButton() { return ( <TouchableOpacity activeOpacity={0.9} onPress={async () => { console.log("Inside on press"); window.recaptchaVerifier = new RecaptchaVerifier('sign-in-button', { 'size': 'invisible', 'callback': (response) => { // reCAPTCHA solved, allow signInWithPhoneNumber. } }, auth); navigation.navigate("Verification", {confirm: confirmation})}} > </TouchableOpacity> ); } } Cuando hago clic en el botón continuar, se activa la función continueButton() , lo que da como resultado el error dado
[Unhandled promise rejection: TypeError: undefined is not a constructor (evaluating 'new _auth.RecaptchaVerifier')] at node_modules/react-native/Libraries/Pressability/Pressability.js:691:17 in _performTransitionSideEffects at node_modules/react-native/Libraries/Pressability/Pressability.js:628:6 in _receiveSignal at node_modules/react-native/Libraries/Pressability/Pressability.js:524:8 in responderEventHandlers.onResponderReleaseHe estado tratando de averiguar la causa raíz del problema, pero no pude averiguar nada. ¿Me pueden ayudar a corregir este error?
por favor intente esto
const WelcomeScreen = ({ navigation }) => { function continueButton() { return ( <TouchableOpacity activeOpacity={0.9} onPress={async () => { console.log("Inside on press"); window.recaptchaVerifier = new RecaptchaVerifier('sign-in-button', { 'size': 'invisible', 'callback': (response) => { return response; // or return some required value here. } }, auth); navigation.navigate("Verification", {confirm: confirmation})}} > </TouchableOpacity> ); }