diff --git a/Gemfile.lock b/Gemfile.lock index 9ec5569aaf6e63..7801444199f7db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,7 +90,7 @@ PLATFORMS DEPENDENCIES activesupport (>= 6.1.7.5, < 7.1.0) - cocoapods (~> 1.13) + cocoapods (~> 1.13, != 1.15.1, != 1.15.0) RUBY VERSION ruby 3.2.0p0 diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index 245a392e854630..b72352f5453f3b 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -52,8 +52,6 @@ - (void)initialize name:RCTAccessibilityManagerDidUpdateMultiplierNotification object:[_moduleRegistry moduleForName:"AccessibilityManager"]]; - _currentInterfaceOrientation = RCTKeyWindow().windowScene.interfaceOrientation; - _currentInterfaceDimensions = [self _exportedDimensions]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -70,10 +68,16 @@ - (void)initialize selector:@selector(interfaceFrameDidChange) name:RCTWindowFrameDidChangeNotification object:nil]; + +#if TARGET_OS_IOS + + _currentInterfaceOrientation = RCTKeyWindow().windowScene.interfaceOrientation; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interfaceFrameDidChange) name:UIDeviceOrientationDidChangeNotification object:nil]; +#endif // TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73 // The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure @@ -109,7 +113,9 @@ - (void)_cleanupObservers [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil]; +#if TARGET_OS_IOS [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; +#endif } static BOOL RCTIsIPhoneNotched() @@ -117,12 +123,14 @@ static BOOL RCTIsIPhoneNotched() static BOOL isIPhoneNotched = NO; static dispatch_once_t onceToken; +#if TARGET_OS_IOS dispatch_once(&onceToken, ^{ RCTAssertMainQueue(); // 20pt is the top safeArea value in non-notched devices isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20; }); +#endif return isIPhoneNotched; } @@ -206,6 +214,7 @@ - (void)interfaceOrientationDidChange - (void)_interfaceOrientationDidChange { +#if TARGET_OS_IOS UIApplication *application = RCTSharedApplication(); UIInterfaceOrientation nextOrientation = RCTKeyWindow().windowScene.interfaceOrientation; @@ -235,6 +244,7 @@ - (void)_interfaceOrientationDidChange _isFullscreen = isRunningInFullScreen; #pragma clang diagnostic pop } +#endif } - (void)interfaceFrameDidChange