Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spinner not hiding when using with alert #61

Closed
fahadhaq opened this issue Oct 18, 2017 · 3 comments
Closed

Spinner not hiding when using with alert #61

fahadhaq opened this issue Oct 18, 2017 · 3 comments

Comments

@fahadhaq
Copy link

Hi, Having an issues if I display the spinner and then call my api, when I get back the result from the api I change my state to hide the spinner. The problem is that if I show an alert to display the error the spinner doesnt hid. It just keeps spinning and cant cancel or anything.

Here is my code

ValidatePromoCode() {
    if (this.state.email != '') {
      this.setState({
        visible: true,
        spinnerText: 'Validating email address'
      });

      //Make the API call
      StudentApi.SetupBuyOnline(this.state.email, DeviceInfo.getUniqueID(), DeviceInfo.getSystemName())
        .then((responseData) => {
          this.setState({
            visible: false,
            spinnerText: ''
          });

          alert(data);
    }
    else {
      this.props.navigation.navigate('GetRegisteredScreen')
    }
  }

Can some one please let me know what I am doing wrong? if i dont have the alert the spinner seems to behave correctly. Thanks in advance

@Daky
Copy link

Daky commented Oct 25, 2017

I will suggest you try to wrap "alert" with setTimeout().

setTimeout(() => {
Alert.alert(I18n.t('MESSAGE'),I18n.t('ACCOUNT_OR_PASSWORD_ERROR'))
}, 100);

@rupalpatel0008
Copy link

@Daky I have put the setTimeout and its still not working

@fahadhaq
Copy link
Author

fahadhaq commented Oct 28, 2017

The above solution is working on iOS. Thanks for your help. The problem is with react native
#30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants