-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Navigation RemovePageInstruction not working correctly #3047
Comments
For me even "../NewPage" does not work. I want existing page to be removed from the stack, and new NewPage is pushed to the stack. NavigationService simply ignores all 'remove from the stack' requests and just pushes a new NewPage on top of the current stack. |
In my repro that seems to work. Can you verify that? |
Yes it works on your repro. I guess my situation is different since I have a complex page construction. 1 - FlyoutPage/NavigationPage/TabbedPage (tabs generated dynamically using KnownNavigationParameters.CreateTab) What works in Xamarin is on PageB go back takes me directly to TabbedPage. In MAUI we go back to PageA, which should've been removed from the stack on step 3. |
You should take into consideration that if your root is not Also you need to remember, that by the logic your NavigationPage cannot be empty (when it does not have root page). Because it does not have any sense in such implementation. And whenever you need an empty NavigationPage you have to think about your architecture and may be smth wrong with it |
My navigation stack is inside the Flyout's content. So there is a stack, even though the app does not start with NavigationPage, but instead starts with FlyoutPage/NavigationPage. This exact code used to work with Prism.Forms btw. This is a %100 migration work. This clearly shows that something changed in PageNavigationService and uri parser that it ignores this remove instruction segment. I haven't find time to debug myself yet tough unfortunately. I'll check myself when I do. |
I debugged this issue and think I found the issue. @bkaankose couldn't repro your case. I created the Tab with the NavigationBuilder and the ../PageB worked properly. |
@lucacivale thanks for stepping up to help out. We would be more than happy to get your PR. A couple of keys to consider here...
|
Description
If I have the navigation stack
MainPage/PageA/PageB/PageC
and want to go back to MainPage without popping each page I should use Prisms RemovePageInstruction and do a navigation on PageC likeNavigateAsync("../../../")
. This worked in Xamarin but it's currently broken. For reference see also #2818.If you navigate with
NavigateAsync("../../../")
the app won't navigate and remains in a broken state.If you instead do
NavigateAsync("../../../PageA")
the navigation works as expected and the new navigation stack isMainPage/PageA
but a new PageA instance was created.Am I missing something or is this a bug?
Repro project
Prism.Navigation.zip
Steps to Reproduce
See attached repro project
Platform with bug
.NET MAUI
Affected platforms
iOS, Android
Did you find any workaround?
If you instead do
NavigateAsync("../../../PageA")
the navigation works as expected and the new navigation stack isMainPage/PageA
but a new PageA instance was created.Relevant log output
No response
The text was updated successfully, but these errors were encountered: