Popover dismiss

Hi All,

I have a popover, that takes me to another page, where I pop back to the root page (popToRoot), reload the data/dom on an event and then dismiss the popup in the promise when the json data comes back from the server. It all works fine if I have a large timeout on the dismiss.

  dismissPopup() {
    if (this.popover) {
      let that = this;
      setTimeout(function () {
        that.popover.dismiss();
      }, 500);
    }
  }

If I make the timeout too low, say 100ms, it does not dismiss because the dom is still loading.

However, I don’t think having a timeout is probably the best practice. What happens if someone has a slow devise, and the time is not enough?

Can anyone please make any suggestions? Should I detect when the dom has loaded, and then call dismiss? How do I check if the dom had loaded?

Thanks

I found a similar issue. There may be some bug or race condition when the popover is dismissed. Seems like it isn’t getting dismissed from the nav stack before the new one is getting pushed. In any case, you need to make sure the popover is completely gone before navigating to the new page. Here is my simple implementation that makes use of the built-in onDidDismiss function:

// Dismiss existing popover
popover.dismiss();

// Wait for notification that popover is completely removed
popover.onDidDismiss(() => {
    // Navigate to new page.  Popover should be gone at this point completely
	this.nav.push(newPage)
});
1 Like

I am facing the same issue after that function call popover is still there on screen.


When I am clicking on OK all the functions are calling but after popover dismiss that popup is not dismissing.