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] Deep linking within a NavigationPage results in an incorrect ContentPage Title on Android #765

Closed
gsfreema opened this issue Sep 8, 2016 · 12 comments

Comments

@gsfreema
Copy link

gsfreema commented Sep 8, 2016

  • Platform: Android KitKat and Lollipop (unsure about Marshmallow since I can't get that running)
  • Prism version: 6.2
  • Xamarin Forms version: 2.3.1.114

Create a new Xamarin Forms Prism application
Make sure you have a few views included and add them to your dependency service (e.g. MainPage, ViewA, ViewB). In my case, I'm using XAML.
Provide a Title for your views (set the Title attribute in your XAML).

In your OnInitialized method for you PrismApplication, Deep link a few views deep inside of a NavigationPage.
NavigationService.NavigateAsync("NavigationPage/MainPage/ViewA/ViewB");

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.

@brianlagunas
Copy link
Member

Thanks for reporting this. As it turns out this is not an issue with Prism, but rather a bug in Xamarin Forms. I have submitted this bug to Xamarin and you can follow the status here:

https://bugzilla.xamarin.com/show_bug.cgi?id=44115

@gsfreema
Copy link
Author

gsfreema commented Sep 8, 2016

Thanks for the quick response and the bugzilla link. You're the man!

@hardcodet
Copy link
Contributor

In case you were not aware: I just noticed that when I do deep navigation with a root navigation page, the order in which the Pushed event on the navigation page is firing (and thus the CurrentPage property is set) is being reverted. So if my stack is:

HomePage -> FooPage -> FooDetailsPage

I end up with the following event order:

1: Pushed: FooDetailsPage (is NavigationPage.CurrentPage)
2: Pushed: FooPage (is NavigationPage.CurrentPage)
3: Pushed: HomePage (is NavigationPage.CurrentPage)

Is this Xamarin, too? Let me know if I should post this onto the Bugzilla ticket you created.

@brianlagunas
Copy link
Member

@hardcodet This is a known issue and has already been reported to Xamarin

https://bugzilla.xamarin.com/show_bug.cgi?id=45978

@brianlagunas brianlagunas removed this from the Prism for XF 6.3 milestone Feb 26, 2017
@davorz
Copy link

davorz commented Mar 20, 2017

Any ideas how to overcome this until the bug is fixed?

@brianlagunas
Copy link
Member

The only work-around is don't deep link

@davorz
Copy link

davorz commented Mar 20, 2017

Deep linking is kinda mandatory for me ... I have companies that are connected to other companies, and so I have to go deep link if I do not want to fill my stack too much :-(

Am I missing the point here, can I destroy pages until certain Uri and then build again or I have to go from root every time?

image

@brianlagunas
Copy link
Member

Unfortunately, this is a bug that has not been fixed by Xamarin. You could try a trick to where you add INavigatonAware to the Page/ViewModel, and in the OnNavigatedTo of the Page to set the Title to the correct text.

@davorz
Copy link

davorz commented Mar 20, 2017

I see. Problem is it's not just title, the whole toolbar is shown from diferent page, in this case the MainPage. What do you think about poping the pages until SearchTab/SearchCompany and then pushing the new Company on the stack. This could result in pop animation for every page but still ...

@brianlagunas
Copy link
Member

Worth a try.

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

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

4 participants