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

ModalDialogService causes navigation issue #78

Closed
banchasf opened this issue Jul 28, 2022 · 2 comments
Closed

ModalDialogService causes navigation issue #78

banchasf opened this issue Jul 28, 2022 · 2 comments

Comments

@banchasf
Copy link

Overview
ModalDialogService cause navigation issue. Sample code is provided in https://github.com/banchasf/nativescript-modal.git

Environment

  • CLI: 8.3.0
  • package.json as in the repository

Describe the bug
When we open Nativescript modal, then close it and it returns a result to the caller component, we found that the modal is not completely closed or destroyed and it causes unexpected navigation. I modified sample master detail app to demonstrate the issue in the repository below
https://github.com/banchasf/nativescript-modal.git

With the code in the repository, we expect the navigation flow to be master -> modal -> detail. In actual result, we get master -> modal -> detail -> master. We can have workaround by using setTimeout to wait until the modal is completely closed. However when the app is in the situation that the host mobile device has low available memory, it needs more delay time to close the modal completely.

To Reproduce

  1. Run the app with the command npx ns run ios --env.aot
  2. Tap a car in the list
  3. Tap to proceed to detail

Expected behavior
When we tap to proceed to the detail, the app should navigate to detail page but it navigate to detail page then redirect back to master page.

Sample project
Code is in https://github.com/banchasf/nativescript-modal.git

Additional context
For the quick fix, I provided a solution in the branch 'navigation' of the repository to have an option to skip navigation history adjustment.

@banchasf banchasf changed the title ModalDialogService cause navigation issue ModalDialogService causes navigation issue Jul 28, 2022
@edusperoni
Copy link
Collaborator

Thanks for reporting it. I'll try to take a look this week or the next. In the meantime you can check the new modal service which follows closely the angular material spec (we've been meaning to deprecate the old one for a while now, since the new one is much more complete and powerful).

There are examples of it in the demo

@edusperoni
Copy link
Collaborator

I'll be closing this and recommending the new NativeDialogService API which has a better API (including beforeClosed and afterClosed observables)

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

2 participants