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 @@ -59,6 +59,7 @@ void IAppearanceObserver.OnAppearanceChanged(ShellAppearance appearance)

public ShellItemRenderer(IShellContext context)
{
this.DisableiOS18ToolbarTabs();
_context = context;
}

Expand Down Expand Up @@ -438,7 +439,19 @@ void UpdateTabBarHidden()
if (ShellItemController == null)
return;


#if IOS18_0_OR_GREATER || MACCATALYST18_0_OR_GREATER
if (OperatingSystemMacCatalyst18Workaround.IsMacCatalystVersionAtLeast18() || OperatingSystem.IsIOSVersionAtLeast(18))
{
TabBarHidden = !ShellItemController.ShowTabs;
}
else
{
TabBar.Hidden = !ShellItemController.ShowTabs;
Comment thread
PureWeen marked this conversation as resolved.
}
#else
TabBar.Hidden = !ShellItemController.ShowTabs;
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class TabbedRenderer : UITabBarController, IPlatformViewHandler
[Microsoft.Maui.Controls.Internals.Preserve(Conditional = true)]
public TabbedRenderer()
{
this.DisableiOS18ToolbarTabs();
_viewHandlerWrapper = new ViewHandlerDelegator<TabbedPage>(Mapper, CommandMapper, this);
}

Expand Down
22 changes: 22 additions & 0 deletions src/Core/src/OperatingSystemMacCatalyst18Workaround.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;

namespace Microsoft.Maui.Platform
{
#if PLATFORM
internal static partial class OperatingSystemMacCatalyst18Workaround
{
public static bool IsMacCatalystVersionAtLeast18()
{
#if !MACCATALYST
return false;
#else
// Delete all uses of this once this is merged
// /https://github.com/xamarin/xamarin-macios/issues/21390


return Environment.OSVersion.Version.Major >= 18;
#endif
}
}
#endif
}
19 changes: 18 additions & 1 deletion src/Core/src/Platform/iOS/TabbedViewExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Foundation;
using Microsoft.Maui.Graphics;
Expand All @@ -9,6 +10,22 @@ namespace Microsoft.Maui.Platform
{
internal static class TabbedViewExtensions
{
internal static void DisableiOS18ToolbarTabs(this UITabBarController tabBarController)
{
#if IOS18_0_OR_GREATER || MACCATALYST18_0_OR_GREATER
// Should apply to iOS and Catalyst
if (OperatingSystemMacCatalyst18Workaround.IsMacCatalystVersionAtLeast18()) //https://github.com/xamarin/xamarin-macios/issues/21390
{
tabBarController.TraitOverrides.HorizontalSizeClass = UIUserInterfaceSizeClass.Compact;
tabBarController.Mode = UITabBarControllerMode.TabSidebar;
}
else if (OperatingSystem.IsIOSVersionAtLeast(18, 0) && UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
{
tabBarController.TraitOverrides.HorizontalSizeClass = UIUserInterfaceSizeClass.Compact;
}
#endif
}

[System.Runtime.Versioning.SupportedOSPlatform("ios15.0")]
[System.Runtime.Versioning.SupportedOSPlatform("tvos15.0")]
internal static void UpdateiOS15TabBarAppearance(
Expand Down Expand Up @@ -104,4 +121,4 @@ internal static void UpdateiOS15TabBarAppearance(
tabBar.StandardAppearance = tabBar.ScrollEdgeAppearance = _tabBarAppearance;
}
}
}
}