diff --git a/packages/react-native/React/CoreModules/RCTAppearance.mm b/packages/react-native/React/CoreModules/RCTAppearance.mm index 4be686344a7d5b..99ff9bfcbd5160 100644 --- a/packages/react-native/React/CoreModules/RCTAppearance.mm +++ b/packages/react-native/React/CoreModules/RCTAppearance.mm @@ -37,15 +37,11 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride) } UITraitCollection* getKeyWindowTraitCollection() { - if ([NSThread isMainThread]) { - return [UIApplication sharedApplication].delegate.window.traitCollection; - } else { - __block UITraitCollection* traitCollection = nil; - dispatch_sync(dispatch_get_main_queue(), ^{ - traitCollection = [UIApplication sharedApplication].delegate.window.traitCollection; - }); - return traitCollection; - } + __block UITraitCollection* traitCollection = nil; + RCTExecuteOnMainQueue(^{ + traitCollection = RCTSharedApplication().delegate.window.traitCollection; + }); + return traitCollection; } NSString *RCTColorSchemePreference(UITraitCollection *traitCollection)