Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,46 @@ void UpdateBarTextColor()
? UINavigationBar.Appearance.TintColor
: iconColor.ToPlatform();

if ((OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26)) && NavigationBar.TintColor is not null)
// iOS 26+ Liquid Glass ignores TintColor for the back button; apply via appearance instead.
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26))
{
if (VisibleViewController?.NavigationItem?.RightBarButtonItems is UIBarButtonItem[] items)
if (NavigationBar.TintColor is not null && VisibleViewController?.NavigationItem?.RightBarButtonItems is UIBarButtonItem[] items)
{
foreach (var item in items)
{
item.TintColor = NavigationBar.TintColor;
}
}

var useCustomColor = iconColor != null && NavPage.OnThisPlatform().GetStatusBarTextColorMode() != StatusBarTextColorMode.DoNotAdjust;
if (useCustomColor)
{
var backColor = iconColor.ToPlatform();
var colorAttributes = NSDictionary<NSString, NSObject>.FromObjectsAndKeys(
new NSObject[] { backColor }, new NSString[] { UIStringAttributeKey.ForegroundColor });
var appearance = new UIBarButtonItemAppearance(UIBarButtonItemStyle.Plain);
appearance.Normal.TitleTextAttributes = colorAttributes;
appearance.Highlighted.TitleTextAttributes = colorAttributes;
NavigationBar.CompactAppearance.BackButtonAppearance = appearance;
NavigationBar.StandardAppearance.BackButtonAppearance = appearance;
NavigationBar.ScrollEdgeAppearance.BackButtonAppearance = appearance;

var backimage = UIImage.GetSystemImage("chevron.backward");
if (backimage is not null)
{
var tinted = backimage.ApplyTintColor(backColor).ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
NavigationBar.BackIndicatorImage = tinted;
NavigationBar.BackIndicatorTransitionMaskImage = tinted;
}
}
else
{
NavigationBar.CompactAppearance.BackButtonAppearance = null;
NavigationBar.StandardAppearance.BackButtonAppearance = null;
NavigationBar.ScrollEdgeAppearance.BackButtonAppearance = null;
NavigationBar.BackIndicatorImage = null;
NavigationBar.BackIndicatorTransitionMaskImage = null;
}
}
}

Expand All @@ -972,7 +1003,7 @@ void SetStatusBarStyle()
{
return;
}

var barTextColor = NavPage.BarTextColor;
var statusBarColorMode = NavPage.OnThisPlatform().GetStatusBarTextColorMode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@ public void TitleIcon_AddingTwice_DoesNotDuplicate()
[Test, Order(13)]
public void Combine_BarBackgroundColor_TextColor_IconColor_Visual()
{
if (App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp))
{
Assert.Ignore("Ignored due to a bug issue in iOS 26"); // Issue Link: https://github.com/dotnet/maui/issues/33966
}
App.WaitForElement("ResetButton");
App.Tap("ResetButton");
// Set bar background color and text color
Expand All @@ -331,7 +327,7 @@ public void Combine_BarBackgroundColor_TextColor_IconColor_Visual()
App.WaitForElement("PushPageButton");
App.Tap("PushPageButton");
// Screenshot: Combined bar background, text color and icon color on pushed page
VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2));
VerifyScreenshot();
}

[Test, Order(14)]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading