Skip to content

Spinner not hiding when using with alert #61

Closed
@fahadhaq

Description

@fahadhaq

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions