Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [Shell] [XF5.0.0] Unable to navigate using PopAsync on Shell #13328

Closed
elicul opened this issue Jan 7, 2021 · 2 comments · Fixed by #13330
Closed

[Bug] [Shell] [XF5.0.0] Unable to navigate using PopAsync on Shell #13328

elicul opened this issue Jan 7, 2021 · 2 comments · Fixed by #13330
Assignees
Milestone

Comments

@elicul
Copy link

elicul commented Jan 7, 2021

Description

Unable to navigate back using Shell.Current.Navigation.PopAsync() on third child Shell page MainPage/FirstPage/SecondPage/ThirdPage. I'm not sure if this is a bug or if it's designed to work like that.

Steps to Reproduce

  1. Start the application
  2. Click on "Click Me!" buttons 3 times until you get a page with a label displaying "Third Page"
  3. Use the mobile hardware back button to go back

Expected Behavior

  • User is navigated back to the "Second Page"

Actual Behavior

  • User is unable to go back

Basic Information

  • Version with issue: Xamarin.Forms 5.0.0.1874
  • Last known good version: Xamarin.Forms 4.8.0 (Latest)
  • Platform Target Frameworks:
    • Android: 11
  • NuGet Packages: Xamarin.Essentials 1.6.0
  • Affected Devices: Samsung Galaxy S9+ SM-G965F (Android 10)

Environment

Show/Hide Visual Studio info
Visual Studio: Visual Studio Professional 2019 16.8.3

Reproduction Link

https://github.com/elicul/XamarinPopAsyncBug/tree/master

Workaround

  • Use Shell.Current.Navigation.RemovePage(Shell.Current.Navigation.NavigationStack.LastOrDefault()); to remove the last page
@elicul elicul added s/unverified New report that has yet to be verified t/bug 🐛 labels Jan 7, 2021
@elicul elicul changed the title [Bug] Unable to navigate using PopAsync on Shell [Bug] [Shell] [XF5.0.0] Unable to navigate using PopAsync on Shell Jan 7, 2021
@samhouts samhouts added this to New in Triage Jan 7, 2021
@PureWeen PureWeen self-assigned this Jan 7, 2021
@PureWeen PureWeen removed the s/unverified New report that has yet to be verified label Jan 7, 2021
@PureWeen PureWeen moved this from New to Ready For Work in Triage Jan 7, 2021
@PureWeen PureWeen added this to the 5.0.0 milestone Jan 7, 2021
@PureWeen PureWeen added this to To do in vNext+1 (5.0.0) via automation Jan 7, 2021
@PureWeen
Copy link
Contributor

PureWeen commented Jan 7, 2021

@elicul This seems to be an issue related to specifying "uri's" with multiple paths

Another workaround here is to register each pages like so

            routes.Add(nameof(FirstPage), typeof(FirstPage));
            routes.Add($"{nameof(SecondPage)}", typeof(SecondPage));
            routes.Add($"{nameof(ThirdPage)}", typeof(ThirdPage));

and then navigate like this

            await Shell.Current.GoToAsync($"{nameof(ThirdPage)}");

@elicul
Copy link
Author

elicul commented Jan 7, 2021

@PureWeen thank you for the quick response. I'll be using your workaround.

@Redth Redth moved this from Ready For Work to Needs Estimate in Triage Jan 7, 2021
@rmarinho rmarinho moved this from To do to In Progress in vNext+1 (5.0.0) Jan 12, 2021
Triage automation moved this from Needs Estimate to Closed Jan 15, 2021
vNext+1 (5.0.0) automation moved this from In Progress to Done Jan 15, 2021
rmarinho pushed a commit that referenced this issue Jan 15, 2021
fixes #13328 fixes #11237

* Fix Shell Navigation for Hierarchally registered Global Routes

* - fix added paths

* - fix relative hierarchical routing

* - remove extra comment

* - remove comments

* - generalize shell setter

* - additional test

* Update BaseShellItem.cs

* - fix routes pushed with longer uris

* - improve matching

* - clean up comments

* - fix multiple back navigation with hierarchies

* - fix root routes

* - fix absolute routes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

2 participants