From e6ddaec431c399d1c81a7a846cf20ab76189ab4d Mon Sep 17 00:00:00 2001 From: xiaoy312 Date: Thu, 13 Feb 2025 07:23:45 -0500 Subject: [PATCH] fix(droid): add workaround for NavView leaving blank on IsBackButtonVisible update --- .../Given_NavigationView.cs | 142 +++++++++++++++--- src/Uno.UI/FeatureConfiguration.cs | 10 ++ .../Controls/NavigationView/NavigationView.cs | 16 ++ 3 files changed, 149 insertions(+), 19 deletions(-) diff --git a/src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_NavigationView.cs b/src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_NavigationView.cs index bddd2428a1ef..55ea3f0dc48d 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_NavigationView.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_NavigationView.cs @@ -1,18 +1,24 @@ -using System.Threading.Tasks; -#if WINAPPSDK +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; +using Windows.UI; +using Uno.Extensions; +using Uno.Extensions.Specialized; using Uno.UI.Extensions; -#elif __IOS__ +using Uno.UI.RuntimeTests.Helpers; + +using static Private.Infrastructure.TestServices; +using MUXC = Microsoft/* UWP don't rename */.UI.Xaml.Controls; + +#if __IOS__ using UIKit; #elif __MACOS__ using AppKit; -#else #endif -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using static Private.Infrastructure.TestServices; -using Windows.UI; -using Microsoft.UI.Xaml.Media; -using Uno.UI.RuntimeTests.Helpers; namespace Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls { @@ -27,16 +33,16 @@ public partial class Given_NavigationView #endif public async Task When_SelectedItem_Set_Before_Load_And_Theme_Changed() { - var navView = new Microsoft/* UWP don't rename */.UI.Xaml.Controls.NavigationView() + var navView = new MUXC.NavigationView() { MenuItems = { - new Microsoft/* UWP don't rename */.UI.Xaml.Controls.NavigationViewItem {Content = "Item 1"}, - new Microsoft/* UWP don't rename */.UI.Xaml.Controls.NavigationViewItem {Content = "Item 2"}, - new Microsoft/* UWP don't rename */.UI.Xaml.Controls.NavigationViewItem {Content = "Item 3"}, + new MUXC.NavigationViewItem {Content = "Item 1"}, + new MUXC.NavigationViewItem {Content = "Item 2"}, + new MUXC.NavigationViewItem {Content = "Item 3"}, }, - PaneDisplayMode = Microsoft/* UWP don't rename */.UI.Xaml.Controls.NavigationViewPaneDisplayMode.LeftMinimal, - IsBackButtonVisible = Microsoft/* UWP don't rename */.UI.Xaml.Controls.NavigationViewBackButtonVisible.Collapsed, + PaneDisplayMode = MUXC.NavigationViewPaneDisplayMode.LeftMinimal, + IsBackButtonVisible = MUXC.NavigationViewBackButtonVisible.Collapsed, }; navView.SelectedItem = navView.MenuItems[1]; var hostGrid = new Grid() { MinWidth = 20, MinHeight = 20 }; @@ -53,9 +59,9 @@ public async Task When_SelectedItem_Set_Before_Load_And_Theme_Changed() await WindowHelper.WaitForIdle(); - var togglePaneButton = navView.FindFirstChild