From cc3880ce1de9ec36b7fe53b2b722c788095ec83f Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 18 Feb 2022 15:38:18 -0800 Subject: [PATCH] Replace currentAppearance with currentDrawingAppearance on macOS 11+ (#1029) --- React/CoreModules/RCTAppearance.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/React/CoreModules/RCTAppearance.mm b/React/CoreModules/RCTAppearance.mm index 26133e1b6a60f9..7d81fae4dc1362 100644 --- a/React/CoreModules/RCTAppearance.mm +++ b/React/CoreModules/RCTAppearance.mm @@ -81,7 +81,11 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride) return RCTAppearanceColorSchemeLight; } - appearance = appearance ?: [NSAppearance currentAppearance]; + if (@available(macOS 11.0, *)) { + appearance = appearance ?: [NSAppearance currentDrawingAppearance]; + } else { + appearance = appearance ?: [NSAppearance currentAppearance]; + } NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]]; return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight; }