I have question regarding email verification in Firebase. Solution to my problem I found here. But when I convert code to react native. It is not working as expected.
My function
const onSignIn = () => {
auth()
.signInAnonymously()
.then(() => {
console.log('User signed in anonymously');
auth()
.onAuthStateChanged((user) => {
user.updateEmail('[email protected]');
user.sendEmailVerification();
})
.catch(function (error) {
console.log('error', error);
});
})
.catch((error) => {
if (error.code === 'auth/operation-not-allowed') {
console.log('Enable anonymous in your firebase console.');
}
console.error(error);
});
navigation.push('SignUpConfirm');
};
Basically what I want to achieve is. When user enters to app, I need to show only email input. Once user enters email address, Firebase should send confirmation code to the email user provided.