dotnet/maui

[Bug] Shell NavigationStack[0] is always null, and Shell.PresentationMode="Modal" doesn't put the Page into ModalStack

SunshineSpring666 opened this issue ยท 14 comments

Description

In many shell apps, we need to let user log in first.
Then after logging in, the user is presented with main pages, and the app should not be able to pop to LoginPage by pressing back button, unless the user manually press a logout button.

Back in Xamarin, we got a way to do this by:
Navigation.InsertPageBefore(new AnnouncementsPage(), this);
await Navigation.PopToRootAsync();

Same method still exists in MAUI Shell, but:
(1) The NavigationStack[0] is always null, no matter how deep the stack is.
(2) Setting Shell.PresentationMode="Modal" doesn't put the LoginPage into ModalStack, it is still in NavigationStack.

NavigationStack 0 isNull
NavigationStack 0 isNull2

Steps to Reproduce

  1. Run the attached demo project.
  2. Click the two different login buttons to log in.
  3. After log in successfully, try press back button.
    The expected behavior is we should be able to block the user from poping to LoginPage.

Link to public reproduction project repository

https://github.com/SunshineSpring666/ShellNavigationStackBug.git

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

Windows SDK 10.0.22000+

Did you find any workaround?

No workaround found.

Relevant log output

No response

Note that I prefer using the NavigationStack , rather than the URI-based navigation scheme.
Hope the Navigation.NavigationStack / Navigation.ModalStack could work ok in MAUI Shell.
Thanks.

RobTF commented

Can confirm same on iOS

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Any new updates?

nor0x commented

same on Android!

Workaround: add a Page before the Mainpage without content.

What is the status of the fix for this issue?

Any new updates?

Any updates?

any updates? ๐Ÿ™

Any updates?

OzaS commented

Any updates?

Any updates ?