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

Title view not displayed after navigating shell tabs #9269

Closed
tdeborde2 opened this issue Aug 8, 2022 · 10 comments · Fixed by #12888
Closed

Title view not displayed after navigating shell tabs #9269

tdeborde2 opened this issue Aug 8, 2022 · 10 comments · Fixed by #12888
Labels
area-controls-titleview TitleView area-controls-toolbar ToolBar fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Milestone

Comments

@tdeborde2
Copy link

tdeborde2 commented Aug 8, 2022

Description

While adding a title view to a new .NET MAUI shell application with a bottom tab bar, I noticed that the title view is removed after returning to first tab. This has only been verified on iOS and macOS.

Repository containing sample project

Steps to Reproduce

  1. Create new .NET MAUI project
  2. Create new Content View (XAML) and set as shell title view.
  3. Add a tab bar and two tabs to the AppShell.xaml.
  4. Launch app and navigate to second tab and return to the first tab.

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 15, macOS 12.3.1

Did you find any workaround?

No response

Relevant log output

No response

@tdeborde2 tdeborde2 added the t/bug Something isn't working label Aug 8, 2022
@Eilon Eilon added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Aug 8, 2022
@PureWeen PureWeen added this to the .NET 7 Planning milestone Aug 9, 2022
@tdeborde2
Copy link
Author

#9687

@tdeborde2
Copy link
Author

After testing on Android, I found that the TitleView is not displayed on the second tab but is still present when navigating back to the first tab.

@HNordhaus
Copy link

I can confirm this happens on Android, too.
And there is a difference between .NET 6 and .NET 7:
6: Icons in the Navigation Bar remain visible, but TapGestureRecognizers do no longer work
7: The Title View is completely clear

This is a really critical issue, as long as there is no workaround.

@PureWeen PureWeen added area-controls-titleview TitleView area/toolbar and removed area-controls-shell Shell Navigation, Routes, Tabs, Flyout labels Oct 17, 2022
@tdeborde2
Copy link
Author

I have found a workaround. By wrapping the shell in a navigation page, the title view is no longer affected by shell tab navigation.

A few things I will mention, this will place the TitleView above the Flyout menu if flyout items are used and the Shell is no longer accessible using Shell.Current. In order to access the shell, I set the shell to a static property in App.xaml.cs, so I can still navigate using routes by calling App.Shell.GoToAsync("//...").

Hopefully this will be resolved soon. The title bar above the menu items is not ideal in my case and I'd rather not have the Shell accessible as a static property in my App class.

I have added an example to the repro project but the steps are listed below.

  1. In App.xaml.cs set MainPage to a new Navigation Page with AppShell set as root.
public App()
{
    InitializeComponent();

    Shell = new AppShell();
    MainPage = new NavigationPage(Shell);
}
  1. In AppShell.xaml set the Navigation.TitleView to the custom TitleView.
<Shell
    x:Class="ShellNavPageTitleView.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:ShellNavPageTitleView"
    NavigationPage.TitleView="{StaticResource TitleView}">
    ...
</Shell>

@LennoxP90
Copy link

@tdeborde2, I like your workaround except for the following:

it doesn't have a back button when you navigate into a sub shell like /page1/page1details
i utilize this using the original titleview off of Shell works great in Android iOS not at all

I am sure i can implement something like this manually, but an official fix from Microsoft would be better appreciated sooner than later.

@vhugogarcia
Copy link
Contributor

vhugogarcia commented Dec 3, 2022

@tdeborde2, I like your workaround except for the following:

it doesn't have a back button when you navigate into a sub shell like /page1/page1details

i utilize this using the original titleview off of Shell works great in Android iOS not at all

I am sure i can implement something like this manually, but an official fix from Microsoft would be better appreciated sooner than later.

You can try the solution posted here. I hope it helps 🙂👍🏻

#9687 (comment) 👈🏻

@robertmaxted
Copy link

Is there a fix for this yet??

@vhugogarcia
Copy link
Contributor

Is there a fix for this yet??

Our friend @PureWeen did a PR with a fix for this. Hopefully, this will be fixed on the next MAUI release which is expected soon... 👍🏻

In the meantime, you can use the workaround posted here #9687 (comment) I hope it helps you :)

@PureWeen
Copy link
Member

Is there a fix for this yet??

Our friend @PureWeen did a PR with a fix for this. Hopefully, this will be fixed on the next MAUI release which is expected soon... 👍🏻

In the meantime, you can use the workaround posted here #9687 (comment) I hope it helps you :)

hopefully the next next release :-)

@robertmaxted
Copy link

Is there a fix for this yet? Also when there is will the fix also be available in Xamarin.forms?? Many thanks

@ghost ghost locked as resolved and limited conversation to collaborators Feb 17, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! label Feb 22, 2023
@samhouts samhouts modified the milestones: .NET 7 Planning, 8.0-preview1 Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-titleview TitleView area-controls-toolbar ToolBar fixed-in-8.0.0-preview.1.7762 Look for this fix in 8.0.0-preview.1.7762! platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants