[BUG] Navigation Title view is not getting displayed with .net 8.0 on Andriord and IOS
RAMESHKUMAR502 opened this issue · comments
Description
I have added an Navigation TitleView for an page but the TitleView is not getting displayed on the page.a
Steps to Reproduce
Added the Sample with Prism
1.launch the Application
2.Login Page is displayed -we have added Naviagtion Navigation TitleView with label and Image
3.TitleView is displayed as white
The Sample and Two Pages 1. Splash page and 2.Login Page
when we launch the Application from Splash page to the login page is navigated.
Mauiprism.zip
Platform with bug
.NET MAUI
Affected platforms
iOS, Android
Did you find any workaround?
No
Relevant log output
No response
i am facing the same issue will implementing navigation the ui and commands aren't working correctly. also gobackroot command and goback command not firing
For my .NET MAUI App I use Prism 9.0.401.20976 and call the following: await this.navigationService.GoBackAsync(parameters).
As a result, an exception is thrown: "Cannot GoBack from NavigationPage Root".
For my .NET MAUI App I use Prism 9.0.401.20976 and call the following: await this.navigationService.GoBackAsync(parameters). As a result, an exception is thrown: "Cannot GoBack from NavigationPage Root".
I ran into this today, funnily enough this workaround works but when you pass back parameters it seems to fail
`
internal async Task NavigateBack()
{
NavigationParameters navParams = [];
if (_requestPageRefresh)
{
navParams.Add(NavParams.PageRefreshLocal, string.Empty);
}
Busy = true;
if (UsingModalNavigation)
{
await Navigation.GoBackAsync((KnownNavigationParameters.UseModalNavigation, true));
}
else
{
await Navigation.GoBackAsync(navParams);
}
Busy = false;
}
`
Luckily in this scenario we don't need to pass parameters back for modal back navigation.
PrismLib 9.0.401-pre
MAUI: 8.0.40
I'm closing this issue due to no valid reproduction. Also if there is an issue it would be a MAUI issue not a Prism issue.
Please keep in mind that Prism's Navigation makes navigating easier but it doesn't change the rules of the Platform itself.
If you have:
window.Page = new MainPage();
You will not see the Navigation Title. In order to do that you would need:
window.Page = new NavigationPage(new MainPage());
Because the Navigation Title is displayed as part of the NavigationPage. While I recognize that this is a sample app... there are a number of mistakes in the navigation here:
- You should not use
nameof(SomeView)
this really creates a coupling between the View and the ViewModel. While it does work and the MVVM police will not come for you, it's also not a good pattern. If you want to use strong typing I would suggest you adopt the Navigation Builder which allows you to Navigate using your ViewModel types for each Navigation segment. - In the PrismAppBuilder's CreateWindow you have used the Builder and effectively done
/Splash
. However when navigating to the LoginPage you actually have a navigation stack that looks like/Splash/LoginPage
. This is a weird pattern and generally after initializing whatever you need in your app and navigating away from the Splash page you would want to be sure to use AbsoluteNavigation. - This brings to the fix if you update
_navigationService.NavigateAsync(nameof(LoginPage));
to_navigationService.NavigateAsync("/NavigationPage/LoginPage");
your Navigation Page Title should be displayed. Also remember you do not need to register anything for the NavigationPage as Prism will do this automatically.