diff --git a/packages/react-native/React/Base/RCTUtils.mm b/packages/react-native/React/Base/RCTUtils.mm index 4a0e1ca40b6b..1ad5afb525c1 100644 --- a/packages/react-native/React/Base/RCTUtils.mm +++ b/packages/react-native/React/Base/RCTUtils.mm @@ -384,13 +384,13 @@ UIDeviceOrientation RCTDeviceOrientation(void) CGSize RCTScreenSize(void) { static CGSize portraitSize; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ + + if (CGSizeEqualToSize(portraitSize, CGSizeZero)) { RCTUnsafeExecuteOnMainQueueSync(^{ CGSize screenSize = [UIScreen mainScreen].bounds.size; portraitSize = CGSizeMake(MIN(screenSize.width, screenSize.height), MAX(screenSize.width, screenSize.height)); }); - }); + } #if !TARGET_OS_TV if (UIDeviceOrientationIsLandscape(RCTDeviceOrientation())) { diff --git a/packages/react-native/React/CoreModules/RCTAlertController.mm b/packages/react-native/React/CoreModules/RCTAlertController.mm index b275ebc5c67e..e8b13f071798 100644 --- a/packages/react-native/React/CoreModules/RCTAlertController.mm +++ b/packages/react-native/React/CoreModules/RCTAlertController.mm @@ -23,6 +23,7 @@ - (UIWindow *)alertWindow UIWindowScene *scene = RCTKeyWindow().windowScene; if (scene != nil) { _alertWindow = [[UIWindow alloc] initWithWindowScene:scene]; + _alertWindow.frame = scene.coordinateSpace.bounds; } else { _alertWindow = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; }