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

[XF] When deep linking within NavigationPage, page order is reversed #1054

Closed
brianlagunas opened this issue May 18, 2017 · 3 comments
Closed

Comments

@brianlagunas
Copy link
Member

brianlagunas commented May 18, 2017

This is a Xamarin.Forms bug and we are awaiting a fix: https://bugzilla.xamarin.com/show_bug.cgi?id=56593

When trying to build up a navigation stack and pushing from a Page that has a NavigationPage parent, the pages are added in the incorrect order, and the middle page is broken.

Given the following example, the expectation is that the final navigation stack would be: ViewA/ViewB/ViewC

Unfortunately the result is ViewA/ViewC/ViewB. Notice that page that should be last is in the middle. Not only that, but ViewC is completely broken and no bindings are retained. Not to mention all the Titles are messed up and are showing the wrong values.

	public partial class App : Application
	{
		public App()
		{			
			MainPage = new NavigationPage(new ViewA());
		}
	}

	public class ViewA : ContentPage
	{
		public ViewA()
		{
			Title = "View A";
			Button btn = new Button() { Text = "Navigate from ViewA", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center };
			btn.Clicked += Btn_Clicked;
			Content = btn;

		}

		private async void Btn_Clicked(object sender, System.EventArgs e)
		{
			var viewB = new ViewB();
			var viewC = new ViewC();

			await viewB.Navigation.PushAsync(viewC);

			await Navigation.PushAsync(viewB);
		}
	}

	public class ViewB : ContentPage
	{
		public ViewB()
		{
			Title = "View B";
			Content = new Label() { Text = "View B" };
		}
	}

	public class ViewC : ContentPage
	{
		public ViewC()
		{
			Title = "ViewC";
			Content = new Label() { Text = "ViewC" };
		}
	}
@dbeylkhanov
Copy link

dbeylkhanov commented Jun 2, 2017

currently I have temporary resolved this issue with separate navigation to the middle page, then from the middle page I'm navigating to the last page inside OnNavigatedTo method for the middle page. Also need to set useModalNavigation flag to false for the transition on a last page

@brianlagunas brianlagunas added this to the Prism 7.0 milestone Jun 27, 2017
@brianlagunas
Copy link
Member Author

Fixed!

@lock
Copy link

lock bot commented Jan 30, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants