Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Why Keyboard dismiss not work on React Native when firebase call?

$
0
0

Keyboard.dismiss() not working when I implement firebase login. The keyboard stays up on to the next page where you have to manually close it. Does anyone know how to get the keyboard to go away?

When I commenting my firebase authentication code then keyboard.dismiss() work perfectly.

here is my working code snippet enter image description here

but when I comment out of firebase authentication code Keyboard.dismiss() not working why happen this?

code:

handleLogin = () => {
    Keyboard.dismiss();
    this.setState({ isLoading: true });

    const { email, password } = this.state;

    firebase
      .auth()
      .signInWithEmailAndPassword(email, password)
      .catch(function(error) {
        Alert.alert('Error', error.message);
      })
      .then(response => {
        this.setState({ isLoading: false });
        if (response) {
          this.setState({ isSuccessful: true });
          this.storeName(response.user.email);

          setTimeout(() => {
            this.props.closeLogin();
            this.setState({ isSuccessful: false });
            setTimeout(() => {
              Alert.alert('Congrats', "You've logged successfully!");
            }, 200);
          }, 1000);
        }
      });
  };

Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>