Last active
May 22, 2020 18:02
-
-
Save mrcflorian/427ae7cdc5d6ece1461046b91bcb1112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import { firebase } from '../../firebase/config' | |
... | |
export default function RegistrationScreen({navigation}) { | |
... | |
const onRegisterPress = () => { | |
if (password !== confirmPassword) { | |
alert("Passwords don't match.") | |
return | |
} | |
firebase | |
.auth() | |
.createUserWithEmailAndPassword(email, password) | |
.then((response) => { | |
const uid = response.user.uid | |
const data = { | |
id: uid, | |
email, | |
fullName, | |
}; | |
const usersRef = firebase.firestore().collection('users') | |
usersRef | |
.doc(uid) | |
.set(data) | |
.then(() => { | |
navigation.navigate('Home', {user: data}) | |
}) | |
.catch((error) => { | |
alert(error) | |
}); | |
}) | |
.catch((error) => { | |
alert(error) | |
}); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment