xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] Setting Shell.TitleView to StaticResource Causes Title to Disappear #14791

Open centrolutions opened 2 years ago

centrolutions commented 2 years ago

Description

On Android, setting Shell.TitleView to a static resource like "{StaticResource HeaderTitleView}" causes the title view to appear momentarily and then disappear.

Steps to Reproduce

  1. Create a new Xamarin.Forms application
  2. Add a resource to app.xaml that defines the title view and give it a key like "HeaderTitleView"
  3. Reference the title view in a content page like: Shell.TitleView={StaticResource HeaderTitleView}"

Expected Behavior

The title will remain on the page as long as the page is visible.

Actual Behavior

The title is shown for a split second and then disappears.

Basic Information

Environment

Show/Hide Visual Studio info ``` Microsoft Visual Studio Professional 2019 Version 16.11.5 VisualStudio.16.Release/16.11.5+31729.503 Microsoft .NET Framework Version 4.8.04084 Installed Version: Professional Visual C++ 2019 00435-20151-31523-AA657 Microsoft Visual C++ 2019 .NET Core Debugging with WSL 1.0 .NET Core Debugging with WSL ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools ASA Service Provider 1.0 ASP.NET and Web Tools 2019 16.11.75.64347 ASP.NET and Web Tools 2019 ASP.NET Web Frameworks and Tools 2019 16.11.75.64347 For additional information, visit https://www.asp.net/ Azure App Service Tools v3.0.0 16.11.75.64347 Azure App Service Tools v3.0.0 Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer. Azure Data Lake Tools for Visual Studio 2.6.3000.0 Microsoft Azure Data Lake Tools for Visual Studio Azure Functions and Web Jobs Tools 16.11.75.64347 Azure Functions and Web Jobs Tools Azure Stream Analytics Tools for Visual Studio 2.6.3000.0 Microsoft Azure Stream Analytics Tools for Visual Studio C# Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info Microsoft Azure HDInsight Azure Node 2.6.3000.0 HDInsight Node under Azure Node Microsoft Azure Hive Query Language Service 2.6.3000.0 Language service for Hive query Microsoft Azure Service Fabric Tools for Visual Studio 16.10 Microsoft Azure Service Fabric Tools for V ![ezgif-3-694f0f548a96](https://user-images.githubusercontent.com/1369631/138730842-d1430f62-6a52-491b-92b2-fbf3f4b726e3.gif) isual Studio Microsoft Azure Stream Analytics Language Service 2.6.3000.0 Language service for Azure Stream Analytics Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE. Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Microsoft Library Manager 2.1.113+g422d40002e.RR Install client-side libraries easily to any web project Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards Microsoft Visual Studio Tools for Containers 1.2 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container. Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package Mono Debugging for Visual Studio 16.10.15 (552afdf) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 5.11.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info Razor (ASP.NET Core) 16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725 Provides languages services for ASP.NET Core Razor. SQL Server Data Tools 16.0.62107.28140 Microsoft SQL Server Data Tools ToolWindowHostedEditor 1.0 Hosting json editor into a tool window TypeScript Tools 16.0.30526.2002 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc Microsoft Visual F# Tools Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio Visual Studio Container Tools Extensions 1.0 View, manage, and diagnose containers within Visual Studio. Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers Visual Studio Tools for Kubernetes 1.0 Visual Studio Tools for Kubernetes VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Foo 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio Xamarin 16.11.000.190 (d16-11@2391ed9) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 16.11.0.17 (remotes/origin/11e0001f0b17269345e80b58fb3adf1ba4efe2cd@11e0001f0) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 16.10.5 (355b57a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 11.4.0.5 (d16-11/7776c9f) Xamarin.Android Reference Assemblies and MSBuild support. Mono: c633fe9 Java.Interop: xamarin/java.interop/d16-11@48766c0 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.35.4@85460d3 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@683f375 Xamarin.iOS and Xamarin.Mac SDK 15.0.0.8 (0796d78dc) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```

Build Logs

Screenshots

ezgif-3-694f0f548a96

Reproduction Link

ShellNavigationIssues.zip

Workaround

Copying and pasting the contents of the Shell.TitleView to every page in the app seems to fix the problem, but is not an acceptable solution.

jfversluis commented 2 years ago

Thanks for the report @centrolutions ! Did you by any chance also test it on iOS?

centrolutions commented 2 years ago

Wow, I'm having quite a day -- closing and opening things -- I've got to get my browser tabs sorted out. Sorry about the extra noise there.

@jfversluis I did try it on iOS. This problem does not appear on iOS, but there is another issue where setting the Shell.TitleView to a StaticResource and having toolbar items will lock the entire app up (but only on iOS). I would say that's probably a separate bug, but I haven't had a chance to report it yet.

centrolutions commented 2 years ago

Any update on this? It appears to have been bouncing around the calendar a bit.

jfversluis commented 2 years ago

Unfortunately not! And not really bouncing, I just use the projects as a sort of todo list so they keep moving forward until we get to them.

carlostdev commented 2 years ago

Any updates on this? We've been facing the same issue for months now

centrolutions commented 1 year ago

This does occur on some iOS devices. I haven't been able to narrow it down, but we have an iPad it's happening on, but an iPhone it's not happening on.

Any chance this can be looked at soon?