I am implementing firebase phone number authentication in React Native app. I am following this documentation: https://invertase.io/oss/react-native-firebase/v6/auth/phone-auth
This successfully runs:
const {confirm} = await firebase.auth().signInWithPhoneNumber(value);
this.setState({confirm})
console.log(confirm) // is a function
Now when I run confirm(code):
try {
await this.state.confirm('123456');
// Successful login - onAuthStateChanged is triggered
} catch (e) {
console.error(e); // Invalid code
}
It gives the following error: TypeError: Cannot read property 'native' of undefined.
I have searched a lot, but couldn't solve it. Please help.