Xamarin.forms: [Bug] Navigation to a route relatively currently doesn't work with Shell

Created on 5 May 2019  路  7Comments  路  Source: xamarin/Xamarin.Forms

Description

Steps to Reproduce

  1. create two flyout items for example as i created:

<FlyoutItem Route="WelcomeFlyout"> <ShellContent Route="Welcome" ContentTemplate="{DataTemplate page:WelcomePage}" /> </FlyoutItem> <FlyoutItem Route="RegisterFlyout"> <ShellContent Route="Register" ContentTemplate="{DataTemplate page:RegisterPage}" /> </FlyoutItem>

  1. from first shellcontent page try to:
    Shell.Current.GoToAsync("Register",false); it will give Timeout exceeded exception in main,cs

Expected Behavior

as it was in all pre-releases<10 it should navigate to the register page

Actual Behavior

exception

Basic Information

  • Version with issue: pre 10
    Last known good version: pre 9
  • IDE: vs2019 for windows
  • It happenes for both:

    • iOS

    • Android

shell 4 help wanted bug up-for-grabs

Most helpful comment

@Hasanajouz Awesome!!
Here's the initial spec for how that all works

https://github.com/xamarin/Xamarin.Forms/issues/5790

We're still getting the behavior for pushing routes on to the stack all finished though. The syntax you initially have will work in upcoming versions

All 7 comments

@Hasanajouz I wasn't able to trigger this with a timeout exception. Currently we don't support relative routing to other routes because shell doesn't currently support a navigation stack for routes.

If you change the navigation to
C# Shell.Current.GoToAsync("Register",false);

does that work?

Shell.Current.GoToAsync("Register",false); is exactly what i tried.

I used to route between other routes without navigation.
so If i have two flyout itmes and i want to go to one of them from the other flyout what should i do now?

while Shell.Current.GoToAsync("Register",false); used to work in pre 9

@Hasanajouz wait I copy and pasted the wrong sample apologies

Can you try
C# Shell.Current.GoToAsync("//Register",false);

@PureWeen yes that worked
Thanks so much.
If you can just give me a link to know where should I use // or / or nothing?

@Hasanajouz Awesome!!
Here's the initial spec for how that all works

https://github.com/xamarin/Xamarin.Forms/issues/5790

We're still getting the behavior for pushing routes on to the stack all finished though. The syntax you initially have will work in upcoming versions

Given the 4.2 RC releases, can we expect this as part of 4.3+?

Follow up question @PureWeen -- since routes aren't pushed on to the stack at this time, what is the suggested approach for back button behavior? Do Shell apps need to maintain their own internal queue by hooking in to Shell.OnNavigated that can be popped as needed?

Currently in our application when attempting to invoke default back button behavior, the application crashes. I'm fairly certain all of the routes are being correctly defined (mix of Xaml and RegisterRoute), and invoked via GoToAsync or visual navigation. All of the documentation, ex: here, seems to suggest default back behavior just works. However, some of the comments in doc issues, ex MicrosoftDocs/xamarin-docs#1401, suggest that's not necessarily the case.

At this point, I'm unclear if this is an issue with our application, an issue with documentation, a framework issue, or some mix of the three.

Was this page helpful?
0 / 5 - 0 ratings