From 6c872d31bbb7ab4c5d2595849b59700e9544ad67 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 2 Jan 2020 20:07:30 +0100 Subject: [PATCH] Implement fix (#8950) fixes #8261 --- .../NativeToolbarTracker.cs | 6 ++++-- Xamarin.Forms.Platform.iOS/Forms.cs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Xamarin.Forms.Platform.MacOS/NativeToolbarTracker.cs b/Xamarin.Forms.Platform.MacOS/NativeToolbarTracker.cs index 064a640c7..c7f0e26ae 100644 --- a/Xamarin.Forms.Platform.MacOS/NativeToolbarTracker.cs +++ b/Xamarin.Forms.Platform.MacOS/NativeToolbarTracker.cs @@ -140,10 +140,12 @@ namespace Xamarin.Forms.Platform.MacOS AllowsUserCustomization = false, ShowsBaselineSeparator = true, SizeMode = NSToolbarSizeMode.Regular, - Delegate = this, - CenteredItemIdentifier = TitleGroupIdentifier + Delegate = this }; + if (Forms.IsMojaveOrNewer) + toolbar.CenteredItemIdentifier = TitleGroupIdentifier; + return toolbar; } diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs index 35281e408..0943a36d5 100644 --- a/Xamarin.Forms.Platform.iOS/Forms.cs +++ b/Xamarin.Forms.Platform.iOS/Forms.cs @@ -38,9 +38,7 @@ namespace Xamarin.Forms static bool? s_isiOS11OrNewer; static bool? s_isiOS13OrNewer; static bool? s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden; -#endif -#if __MOBILE__ internal static bool IsiOS9OrNewer { get @@ -91,6 +89,19 @@ namespace Xamarin.Forms return s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden.Value; } } +#else + static bool? s_isMojaveOrNewer; + + internal static bool IsMojaveOrNewer + { + get + { + if (!s_isMojaveOrNewer.HasValue) + s_isMojaveOrNewer = NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion(new NSOperatingSystemVersion(10, 14, 0)); + return s_isMojaveOrNewer.Value; + } + } + #endif static IReadOnlyList s_flags;