title: React Native & Firebase : user info not being stored in database
body: <p>I'm trying to create a new user and store their information in firebase database. I successfully create the user but the user information isn't getting stored in firebase.</p>
  
  <p>The function that is running is <code>handleAuthWithFirebase</code></p>
  
  <p>The <code>console.log("Storing user")</code> is showing up in the console so I'm not sure why <code>firebase.database().ref().set</code> isn't running. </p>
  
  <p>Here is my code</p>
  
  <pre class="lang-js prettyprint-override"><code>export function handleAuthWithFirebase (newUser) {
      return function (dispatch, getState) {
          dispatch(authenticating());
  
          console.log(newUser);
          console.log('Signing up user');
          var email = newUser.email;
          var password = newUser.password;
  
          firebase.auth().createUserWithEmailAndPassword(email, password).catch(error =&gt; {
          // Handle Errors here.
          var errorCode = error.code;
          var errorMessage = error.message;
          // ...
          }).then(() =&gt; {
  
              const user = firebase.auth().currentUser;
              // Set user in Firebase
              console.log("Storing user")
              firebase.database().ref('/users/' + user.uid).set({
                  name: newUser.displayName,
                  username: newUser.username,
                  email: newUser.email
              })
          }).then(() =&gt; {
              const user = firebase.auth().currentUser;
              dispatch(isAuthed(user.uid))
          })
      }
  }
  </code></pre>