From 815c415fb90944db89552a503eb53059e9f0d20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Thu, 27 Jun 2024 07:58:50 -0700 Subject: [PATCH] refactor: supportedInterfaceOrientations method to use RCTKeyWindow() (#43026) Summary: This PR refactors `supportedInterfaceOrientations` to use RCTKeyWindow instead of `[RCTSharedApplication() keyWindow]`. ## Changelog: [IOS] [CHANGED] - Refactor supportedInterfaceOrientations method to use RCTKeyWindow() Pull Request resolved: https://github.com/facebook/react-native/pull/43026 Test Plan: CI Green Reviewed By: dmytrorykun Differential Revision: D59109614 Pulled By: cipolleschi fbshipit-source-id: 025534c419078dce29e1e5caacf8a1b15de1abcc --- .../ComponentViews/Modal/RCTFabricModalHostViewController.mm | 2 +- packages/react-native/React/Views/RCTModalHostViewController.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm index ff8810cba40..bc8c2bab4d9 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm @@ -62,7 +62,7 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations { UIInterfaceOrientationMask appSupportedOrientationsMask = - [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]]; + [RCTSharedApplication() supportedInterfaceOrientationsForWindow:RCTKeyWindow()]; if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) { RCTLogError( @"Modal was presented with 0x%x orientations mask but the application only supports 0x%x." diff --git a/packages/react-native/React/Views/RCTModalHostViewController.m b/packages/react-native/React/Views/RCTModalHostViewController.m index 50075ffd484..38629cf2eb1 100644 --- a/packages/react-native/React/Views/RCTModalHostViewController.m +++ b/packages/react-native/React/Views/RCTModalHostViewController.m @@ -54,7 +54,7 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations { UIInterfaceOrientationMask appSupportedOrientationsMask = - [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]]; + [RCTSharedApplication() supportedInterfaceOrientationsForWindow:RCTKeyWindow()]; if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) { RCTLogError( @"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."