delete RCTUIUtils (#49453)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49453

changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D69716706

fbshipit-source-id: 46e786de85fbee142855384e2338529de6c8a644
This commit is contained in:
Samuel Susla authored and Facebook GitHub Bot committed 2025-02-17 06:40:36 -08:00
1 parent 176bed79b4
commit 49b7ce0856
3 files changed
+16 -72

No files matched your search

@@ -14,7 +14,6 @@
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTInitializing.h>
#import <React/RCTInvalidating.h>
#import <React/RCTUIUtils.h>
#import <React/RCTUtils.h>
#import <atomic>
@@ -162,20 +161,25 @@ static BOOL RCTIsIPhoneNotched()
static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
{
RCTAssertMainQueue();
RCTDimensions dimensions = RCTGetDimensions(fontScale);
__typeof(dimensions.window) window = dimensions.window;
UIScreen *mainScreen = UIScreen.mainScreen;
CGSize screenSize = mainScreen.bounds.size;
UIView *mainWindow = RCTKeyWindow();
// We fallback to screen size if a key window is not found.
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
NSDictionary<NSString *, NSNumber *> *dimsWindow = @{
@"width" : @(window.width),
@"height" : @(window.height),
@"scale" : @(window.scale),
@"fontScale" : @(window.fontScale)
@"width" : @(windowSize.width),
@"height" : @(windowSize.height),
@"scale" : @(mainScreen.scale),
@"fontScale" : @(fontScale)
};
__typeof(dimensions.screen) screen = dimensions.screen;
NSDictionary<NSString *, NSNumber *> *dimsScreen = @{
@"width" : @(screen.width),
@"height" : @(screen.height),
@"scale" : @(screen.scale),
@"fontScale" : @(screen.fontScale)
@"width" : @(screenSize.width),
@"height" : @(screenSize.height),
@"scale" : @(mainScreen.scale),
@"fontScale" : @(fontScale)
};
return @{@"window" : dimsWindow, @"screen" : dimsScreen};
}
@@ -1,30 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
#ifdef __cplusplus
extern "C" {
#endif
// Get window and screen dimensions
typedef struct {
struct {
CGFloat width, height, scale, fontScale;
} window, screen;
} RCTDimensions;
extern __attribute__((visibility("default"))) RCTDimensions RCTGetDimensions(CGFloat fontScale);
#ifdef __cplusplus
}
#endif
NS_ASSUME_NONNULL_END
@@ -1,30 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTUIUtils.h"
#import "RCTUtils.h"
RCTDimensions RCTGetDimensions(CGFloat fontScale)
{
UIScreen *mainScreen = UIScreen.mainScreen;
CGSize screenSize = mainScreen.bounds.size;
UIView *mainWindow = RCTKeyWindow();
// We fallback to screen size if a key window is not found.
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
RCTDimensions result;
typeof(result.screen) dimsScreen = {
.width = screenSize.width, .height = screenSize.height, .scale = mainScreen.scale, .fontScale = fontScale};
typeof(result.window) dimsWindow = {
.width = windowSize.width, .height = windowSize.height, .scale = mainScreen.scale, .fontScale = fontScale};
result.screen = dimsScreen;
result.window = dimsWindow;
return result;
}