[BUG] Absolute navigation not updating 'Application.Current.MainPage' in Android in .Net MAUI
lakhanimilan opened this issue · comments
Description
When doing absolute navigation with '/' in .NetMaui prism, Application's current page's MainPage property is not updated to the latest page.
It is working fine with iOS.
Code
await navigationService.NavigateAsync($"/{nameof(AbsolutePage)}");
While doing this navigation following property [Application.Current.MainPage
] is not updated with AbsolutePage
it is showing value of old page.
Steps to Reproduce
- Create a maui app solution
- Configure with prism
- Do navigation with absolute navigation [
await navigationService.NavigateAsync($"/{nameof(AbsolutePage)}");
] fromMainPage
- Verify
Application.Current.MainPage
property, it should be updated with latest pageAbsolutePage
.
Platform with bug
.NET MAUI
Affected platforms
Android
Did you find any workaround?
No response
Relevant log output
No response
First of all please be sure to open Prism.Maui issues in the correct repo. I have gone ahead and transferred this for you.
Second of all it is important to remember that .NET MAUI is NOT Xamarin.Forms. You should not be referencing Application.Current.MainPage. This was a concept that the team had to maintain for some slight backwards compatibility, however Prism.Maui does not make use of it at any point. As .NET Maui has a concept of 1-* application windows the appropriate thing is to iterate over the windows and get the Window.Page.