Skip to content

iOS: issue when trying to chain modal pages within promise #5744

@felixkrautschuk

Description

@felixkrautschuk

Did you verify this is a real problem by searching the [NativeScript Forum]

YES

Which platform(s) does your issue occur on?

iOS

Tell us about the problem

I try to show multiple independent modal pages one after the other using a promise:

new Promise(function(resolve, reject) {
        application.getRootView().showModal(
            "modal-page",
            null,
            function() {
                resolve(true);
            },
            false
        );
    }).then(function(response) {
        if(application.getRootView().modal) {
            application.getRootView().closeModal();
        } else {
            console.log("closing modal page is not neccessary, as there is no open modal page...");
        }

        try {
            application.getRootView().showModal(
                "modal-page",
                null,
                function() {
                    var topmost = frameModule.topmost();
                    if(topmost) {
                        topmost.navigate({
                            moduleName: "second-page",
                            animated: true
                        });
                    }
                },
                false
            );
        } catch(e) {
            console.log(e);
        }
    });

It opens the first modal page and when I close it to see the next, I always get the following error mesage:
Error: Parent page is not part of the window hierarchy. Close the current modal page before showing another one!

I am not sure if this is the expected behaviour, so I need to know what I am doing wrong. Please note, that in our real app there are some conditions for showing the modal pages, so it might be possible to skip one of the modal pages or even all of them.

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.0.0
  • Cross-platform modules: next (4.0.0-2018-04-25-02)
  • Runtime(s): 4.0.2

Please tell us how to recreate the issue in as much detail as possible.

  1. Start the app
  2. Tap the button to open the first modal
  3. tap the button to close this modal, so the second modal should be opened, but this does not happen on iOS.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

NSIssues4.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions