Bug 44115 - Multiple navigations in NavigationPage results in an incorrect Title on Android
Summary: Multiple navigations in NavigationPage results in an incorrect Title on Android
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.1
Hardware: PC Windows
: Highest normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2016-09-08 15:11 UTC by Brian Lagunas
Modified: 2017-06-28 00:39 UTC (History)
12 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Brian Lagunas 2016-09-08 15:11:18 UTC
When performing consecutive navigation operations within a NavigationPage, the title on the navigation bar shows the incorrect title.  Given the following application

    public class App : Application
    {
        public App()
        {
            var mainPage = new MainPage();
            var viewA = new ViewA();
            var viewB = new ViewB();

            viewA.Navigation.PushAsync(viewB);
            mainPage.Navigation.PushAsync(viewA);

            MainPage = new NavigationPage(mainPage);
        }
    }

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

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

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

When starting this application the Visual Studio Emulator for Android, you will see that the final view is displayed, but the title is that of the first page after NavigationPage. In the example above, you will see ViewB, but the title will be the title of MainPage. Navigating back will show the titles correctly as you unwind the stack.
Comment 1 Brian Lagunas 2017-04-18 23:13:13 UTC
Can I get an update on when this will be fixed?
Comment 2 Brian Lagunas 2017-05-18 04:46:30 UTC
Is there any update on a fix?
Comment 3 Chase Florell 2017-05-30 20:32:01 UTC
I too am looking for an update on this.
Comment 4 James Montemagno [MSFT] 2017-05-31 02:12:31 UTC
what if you did.....

 viewA.Navigation.PushAsync(viewB).ContinueWith(()=>
{
            viewB.Navigation.PushAsync(viewA);
});

? you are not following the async/await stuff in your example.
Comment 5 James Montemagno [MSFT] 2017-05-31 02:13:19 UTC
Or more over it seems like you want to insert into the stack and not actually navigate into it... can you manage the pages that way?
Comment 6 Brian Lagunas 2017-05-31 02:22:40 UTC
It doesn't matter if you await the calls or not.  In the production code, everything is awaited properly.  Even if you await the calls in the sample, the issue still occurs.

Unfortunately, inserting into the stack is not an option.  There is only Navigation.InsertBefore which is not an approach I can rely on as I do not know the intent of the navigation.  To be more clear, this is an issue experienced when using the deep linking feature in Prism.  The sample here is merely to demonstrate the issue using non-Prism based code so that is can easily be reproducible and investigated for a fix.  In the context of deep linking, it would be more desirable to not actually navigate to the pages (although this navigation is not visible to the user since it occurs while disconnected from the App's Navigation.NavigationStack), but there is not a Navigation.Insert method that can be used to add pages to the navigation stack.
Comment 7 Rui Marinho 2017-06-14 12:19:57 UTC
https://github.com/PrismLibrary/Prism/pull/1082
Comment 8 Brian Lagunas 2017-06-28 00:39:53 UTC
This has been fixed with Rui's awesome PR.