From 7374a892b11b18a8f103131e25d6fc61a22efe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Tue, 13 Feb 2024 16:04:59 +0100 Subject: [PATCH] fix: add ifdef to status bar APIs --- ios/RNSScreen.mm | 2 +- ios/RNSScreenWindowTraits.h | 2 +- ios/RNSScreenWindowTraits.mm | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index 5a90f9c999..f07d591f40 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -229,7 +229,7 @@ - (void)setActivityStateOrNil:(NSNumber *)activityStateOrNil } } -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_VISION - (void)setStatusBarStyle:(RNSStatusBarStyle)statusBarStyle { _hasStatusBarStyleSet = YES; diff --git a/ios/RNSScreenWindowTraits.h b/ios/RNSScreenWindowTraits.h index 1970b9d0b8..0665bdce6e 100644 --- a/ios/RNSScreenWindowTraits.h +++ b/ios/RNSScreenWindowTraits.h @@ -4,7 +4,7 @@ + (void)updateWindowTraits; -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_VISION + (void)assertViewControllerBasedStatusBarAppearenceSet; #endif + (void)updateStatusBarAppearance; diff --git a/ios/RNSScreenWindowTraits.mm b/ios/RNSScreenWindowTraits.mm index cf7d7b0a2c..e407fdb4ae 100644 --- a/ios/RNSScreenWindowTraits.mm +++ b/ios/RNSScreenWindowTraits.mm @@ -4,7 +4,7 @@ @implementation RNSScreenWindowTraits -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_VISION + (void)assertViewControllerBasedStatusBarAppearenceSet { static dispatch_once_t once; @@ -25,8 +25,8 @@ + (void)updateStatusBarAppearance #if !TARGET_OS_TV && !TARGET_OS_VISION [UIView animateWithDuration:0.4 animations:^{ // duration based on "Programming iOS 13" p. 311 implementation - [RCTKeyWindow().rootViewController setNeedsStatusBarAppearanceUpdate]; - }]; + [RCTKeyWindow().rootViewController setNeedsStatusBarAppearanceUpdate]; + }]; #endif } @@ -112,7 +112,7 @@ + (void)enforceDesiredDeviceOrientation #if !TARGET_OS_TV && !TARGET_OS_VISION dispatch_async(dispatch_get_main_queue(), ^{ UIInterfaceOrientationMask orientationMask = [RCTKeyWindow().rootViewController supportedInterfaceOrientations]; - + UIInterfaceOrientation currentDeviceOrientation = [RNSScreenWindowTraits interfaceOrientationFromDeviceOrientation:[[UIDevice currentDevice] orientation]]; UIInterfaceOrientation currentInterfaceOrientation = [RNSScreenWindowTraits interfaceOrientation];