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

[BUG] Navigation Title view is not getting displayed with .net 8.0 on Andriord and IOS #3107

Closed
RAMESHKUMAR502 opened this issue Mar 20, 2024 · 4 comments

Comments

@RAMESHKUMAR502
Copy link

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

@mohammedmsadiq
Copy link

mohammedmsadiq commented Mar 21, 2024

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

@peter-70
Copy link

peter-70 commented May 13, 2024

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".

@mackayn
Copy link

mackayn commented Jun 5, 2024

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

@dansiegel
Copy link
Member

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:

  1. 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.
  2. 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.
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants