Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { email, username, password } = this.state;
- await firebase
- .auth()
- .createUserWithEmailAndPassword(email, password)
- .then(async user => {
- console.log('Data created', user);
- let rootRef = firebase.database().ref()
- rootRef.child("users")
- .orderByChild("username")
- .equalTo(username)
- .once("value")
- .then(snapshot => {
- if (snapshot.exists()) {
- let userData = snapshot.val()
- console.log(userData)
- Alert.alert('username is taken')
- return userData;
- }else {
- console.log('not found')
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement