Skip to content
Closed
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 @@ -535,7 +535,14 @@ protected virtual void UpdateTabBarItem()

ShellSection.Icon.LoadImage(ShellSection.FindMauiContext(), icon =>
{
TabBarItem = new UITabBarItem(ShellSection.Title, icon?.Value, null);
// iOS 26+ requires images to use AlwaysTemplate rendering mode for tint colors to work on unselected items
UIImage tabIcon = icon?.Value;
if (tabIcon != null && (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26)))
{
tabIcon = tabIcon.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
}

TabBarItem = new UITabBarItem(ShellSection.Title, tabIcon, null);
TabBarItem.AccessibilityIdentifier = ShellSection.AutomationId ?? ShellSection.Title;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,19 @@ async void SetTabBarItem(IPlatformViewHandler renderer)
throw new InvalidCastException($"{nameof(renderer)} must be a {nameof(Page)} renderer.");

var icons = await GetIcon(page);
renderer.ViewController.TabBarItem = new UITabBarItem(page.Title, icons?.Item1, icons?.Item2)

// iOS 26+ requires images to use AlwaysTemplate rendering mode for tint colors to work on unselected items
UIImage icon = icons?.Item1;
UIImage selectedIcon = icons?.Item2;
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26))
{
if (icon != null)
icon = icon.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
if (selectedIcon != null)
selectedIcon = selectedIcon.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
}

renderer.ViewController.TabBarItem = new UITabBarItem(page.Title, icon, selectedIcon)
{
Tag = Tabbed?.Children.IndexOf(page) ?? -1,
AccessibilityIdentifier = page.AutomationId
Expand Down
10 changes: 10 additions & 0 deletions src/Core/src/Platform/iOS/TabbedViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ internal static void UpdateiOS15TabBarAppearance(

// Set the TabBarAppearance
tabBar.StandardAppearance = tabBar.ScrollEdgeAppearance = _tabBarAppearance;

// iOS 26+ has a bug where IconColor in UITabBarAppearance doesn't work for unselected items
// Workaround: Set UnselectedItemTintColor directly on the UITabBar
if (OperatingSystem.IsIOSVersionAtLeast(26) || OperatingSystem.IsMacCatalystVersionAtLeast(26) || OperatingSystem.IsTvOSVersionAtLeast(26))
{
if (unselectedTabColor is not null)
{
tabBar.UnselectedItemTintColor = unselectedTabColor.ToPlatform();
}
}
}
}
}
Loading