NativeScript: Unable to show dialog from a modal page

Reporting from iOS. Calling this function from inside a modal page:

exports.selectPhoto = function() {
  dialogs.action({
    message: "Select new photo",
    cancelButtonText: "Cancel",
    actions: ["Take photo", "Select from Photos"]
  }).then(function (result) {
    console.log(result);
  });
};

Will give me the error:

Warning: Attempt to present <UIAlertController: 0x7cbd3a00> on <UIViewControllerImpl: 0x7b7a88b0> whose view is not in the window hierarchy!

What is this, and how do I fix it?

Thanks in advance!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Ups, sorry for buzzing 😊. Just found the solution - instead of topmost().page.showModal must be used topmost().currentPage.showModal, and everything works as expected!