From 0ee411801cdea7cbcac0b02970b28d309d93428c Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 21 Sep 2026 14:41:59 -0400 Subject: [PATCH] Report the window safe area insets through Dimensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Dimensions.get('window').experimental_safeAreaInsets` (and `useWindowDimensions`) reports the safe area insets of the window, using the same native computation as the view prop applied to the window itself. Unlike the prop, this is available synchronously at startup — no event has to arrive first — and it updates through the existing `change` event. That is what the safe area context library needs `initialWindowMetrics` for, its last remaining native module, and it is what lets a component render padded on its very first frame instead of correcting itself once the first inset event lands. The field is absent on platforms and versions that cannot report it, rather than reported as zeros, so a consumer can tell "no insets" from "unknown". --- .../Libraries/Utilities/Dimensions.js | 25 +++++++-- .../Utilities/__tests__/Dimensions-itest.js | 20 ++++++++ .../Utilities/useWindowDimensions.js | 21 +++++++- .../React/CoreModules/RCTDeviceInfo.mm | 12 ++++- .../modules/deviceinfo/DeviceInfoModule.kt | 20 +++++++- .../react/coremodules/DeviceInfoModule.h | 11 +++- .../modules/NativeDeviceInfo.js | 9 ++++ .../SafeAreaInsets/SafeAreaInsetsExample.js | 26 ++++++++++ .../api-snapshots/ReactAndroidDebugCxx.api | 38 ++++++++++---- .../api-snapshots/ReactAndroidNewarchCxx.api | 34 +++++++++---- .../api-snapshots/ReactAndroidReleaseCxx.api | 34 +++++++++---- .../api-snapshots/ReactAppleDebugCxx.api | 51 ++++++++++++++++--- .../api-snapshots/ReactAppleNewarchCxx.api | 47 ++++++++++++++--- .../api-snapshots/ReactAppleReleaseCxx.api | 47 ++++++++++++++--- 14 files changed, 340 insertions(+), 55 deletions(-) diff --git a/packages/react-native/Libraries/Utilities/Dimensions.js b/packages/react-native/Libraries/Utilities/Dimensions.js index 13458dd737db..f8e1cf2647bc 100644 --- a/packages/react-native/Libraries/Utilities/Dimensions.js +++ b/packages/react-native/Libraries/Utilities/Dimensions.js @@ -16,10 +16,16 @@ import NativeDeviceInfo, { type DimensionsPayload, type DisplayMetrics, type DisplayMetricsAndroid, + type WindowSafeAreaInsets, } from './NativeDeviceInfo'; import invariant from 'invariant'; -export type {DimensionsPayload, DisplayMetrics, DisplayMetricsAndroid}; +export type { + DimensionsPayload, + DisplayMetrics, + DisplayMetricsAndroid, + WindowSafeAreaInsets, +}; /** @deprecated Use DisplayMetrics */ export type ScaledSize = DisplayMetrics; @@ -72,11 +78,22 @@ class Dimensions { let {screen, window} = dims; const {windowPhysicalPixels} = dims; if (windowPhysicalPixels) { + const {scale, experimental_safeAreaInsets: safeAreaInsets} = + windowPhysicalPixels; window = { - width: windowPhysicalPixels.width / windowPhysicalPixels.scale, - height: windowPhysicalPixels.height / windowPhysicalPixels.scale, - scale: windowPhysicalPixels.scale, + width: windowPhysicalPixels.width / scale, + height: windowPhysicalPixels.height / scale, + scale, fontScale: windowPhysicalPixels.fontScale, + experimental_safeAreaInsets: + safeAreaInsets == null + ? null + : { + top: safeAreaInsets.top / scale, + right: safeAreaInsets.right / scale, + bottom: safeAreaInsets.bottom / scale, + left: safeAreaInsets.left / scale, + }, }; } const {screenPhysicalPixels} = dims; diff --git a/packages/react-native/Libraries/Utilities/__tests__/Dimensions-itest.js b/packages/react-native/Libraries/Utilities/__tests__/Dimensions-itest.js index e4481e8f8be1..4bcb6261d23a 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/Dimensions-itest.js +++ b/packages/react-native/Libraries/Utilities/__tests__/Dimensions-itest.js @@ -30,6 +30,26 @@ describe('Dimensions', () => { expect(Dimensions.get('window').fontScale).toEqual(3); }); + it('should scale window safe area insets from physical pixels', () => { + Dimensions.set({ + windowPhysicalPixels: { + width: 400, + height: 800, + scale: 2, + densityDpi: 2, + fontScale: 3, + experimental_safeAreaInsets: {top: 96, right: 0, bottom: 48, left: 0}, + }, + }); + + expect(Dimensions.get('window').experimental_safeAreaInsets).toEqual({ + top: 48, + right: 0, + bottom: 24, + left: 0, + }); + }); + it('should set screen dimensions on Android', () => { // $FlowFixMe[incompatible-type] - `Platform.OS` needs to be read-only. Platform.OS = 'android'; diff --git a/packages/react-native/Libraries/Utilities/useWindowDimensions.js b/packages/react-native/Libraries/Utilities/useWindowDimensions.js index 02e35b6df780..65fb58d1f20e 100644 --- a/packages/react-native/Libraries/Utilities/useWindowDimensions.js +++ b/packages/react-native/Libraries/Utilities/useWindowDimensions.js @@ -15,6 +15,21 @@ import { } from './NativeDeviceInfo'; import {useEffect, useState} from 'react'; +function safeAreaInsetsAreEqual( + a: DisplayMetrics['experimental_safeAreaInsets'], + b: DisplayMetrics['experimental_safeAreaInsets'], +): boolean { + if (a == null || b == null) { + return a == null && b == null; + } + return ( + a.top === b.top && + a.right === b.right && + a.bottom === b.bottom && + a.left === b.left + ); +} + /** * React hook that provides the application window's width, height, scale, and * font scale. Automatically updates when screen size or font scale changes. @@ -35,7 +50,11 @@ export default function useWindowDimensions(): dimensions.width !== window.width || dimensions.height !== window.height || dimensions.scale !== window.scale || - dimensions.fontScale !== window.fontScale + dimensions.fontScale !== window.fontScale || + !safeAreaInsetsAreEqual( + dimensions.experimental_safeAreaInsets, + window.experimental_safeAreaInsets, + ) ) { setDimensions(window); } diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index 1761214fc3bd..40b5f219bf11 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -202,11 +202,19 @@ static BOOL RCTIsIPhoneNotched() // We fallback to screen size if a key window is not found. CGSize windowSize = mainWindow != nil ? mainWindow.bounds.size : screenSize; - NSDictionary *dimsWindow = @{ + UIEdgeInsets insets = mainWindow.safeAreaInsets; + id safeAreaInsets = mainWindow != nil + ? @{@"top" : @(insets.top), + @"right" : @(insets.right), + @"bottom" : @(insets.bottom), + @"left" : @(insets.left)} + : (id)kCFNull; + NSDictionary *dimsWindow = @{ @"width" : @(windowSize.width), @"height" : @(windowSize.height), @"scale" : @(screen.scale), - @"fontScale" : @(fontScale) + @"fontScale" : @(fontScale), + @"experimental_safeAreaInsets" : safeAreaInsets }; NSDictionary *dimsScreen = @{ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt index e40a8f1221f6..7b1da36f45fb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt @@ -23,6 +23,7 @@ import com.facebook.react.bridge.WritableNativeMap import com.facebook.react.module.annotations.ReactModule import com.facebook.react.uimanager.DisplayMetricsHolder.getScreenDisplayMetrics import com.facebook.react.uimanager.DisplayMetricsHolder.initDisplayMetricsIfNotInitialized +import com.facebook.react.uimanager.internal.SafeAreaInsetsObserver import com.facebook.react.views.view.isEdgeToEdgeFeatureFlagOn /** Module that exposes Android Constants to JS. */ @@ -83,7 +84,9 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) : WritableNativeMap().apply { putMap( "windowPhysicalPixels", - getPhysicalPixelsWritableMap(getWindowDisplayMetrics()), + getPhysicalPixelsWritableMap(getWindowDisplayMetrics()).apply { + putMap("experimental_safeAreaInsets", getWindowSafeAreaInsetsWritableMap()) + }, ) putMap( "screenPhysicalPixels", @@ -91,6 +94,21 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) : ) } + /** + * The part of the window that is covered by the system UI, in physical pixels. Uses the same + * computation as the `onSafeAreaInsetsChange` view prop, applied to the window's decor view. + */ + private fun getWindowSafeAreaInsetsWritableMap(): WritableMap? { + val decorView = reactApplicationContext.currentActivity?.window?.decorView ?: return null + val insets = SafeAreaInsetsObserver.getSafeAreaInsets(decorView) ?: return null + return WritableNativeMap().apply { + putInt("top", insets.top) + putInt("right", insets.right) + putInt("bottom", insets.bottom) + putInt("left", insets.left) + } + } + private fun getPhysicalPixelsWritableMap( displayMetrics: DisplayMetrics, ): WritableMap = diff --git a/packages/react-native/ReactCxxPlatform/react/coremodules/DeviceInfoModule.h b/packages/react-native/ReactCxxPlatform/react/coremodules/DeviceInfoModule.h index c750cf971521..8caddbe6a2bc 100644 --- a/packages/react-native/ReactCxxPlatform/react/coremodules/DeviceInfoModule.h +++ b/packages/react-native/ReactCxxPlatform/react/coremodules/DeviceInfoModule.h @@ -12,9 +12,13 @@ namespace facebook::react { -using DisplayMetrics = NativeDeviceInfoDisplayMetrics; +using WindowSafeAreaInsets = NativeDeviceInfoWindowSafeAreaInsets; -using DisplayMetricsAndroid = NativeDeviceInfoDisplayMetricsAndroid; +using DisplayMetrics = + NativeDeviceInfoDisplayMetrics>; + +using DisplayMetricsAndroid = + NativeDeviceInfoDisplayMetricsAndroid>; using DimensionsPayload = NativeDeviceInfoDimensionsPayload< std::optional, @@ -25,6 +29,9 @@ using DimensionsPayload = NativeDeviceInfoDimensionsPayload< using DeviceInfoConstants = NativeDeviceInfoDeviceInfoConstants, std::optional>; +template <> +struct Bridging : NativeDeviceInfoWindowSafeAreaInsetsBridging {}; + template <> struct Bridging : NativeDeviceInfoDisplayMetricsBridging {}; diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.js index 57d18b6bd3ab..023515c71802 100644 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.js +++ b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.js @@ -12,12 +12,20 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; +export type WindowSafeAreaInsets = { + top: number, + right: number, + bottom: number, + left: number, +}; + export type DisplayMetricsAndroid = { width: number, height: number, scale: number, fontScale: number, densityDpi: number, + readonly experimental_safeAreaInsets?: ?WindowSafeAreaInsets, }; export type DisplayMetrics = { @@ -25,6 +33,7 @@ export type DisplayMetrics = { height: number, scale: number, fontScale: number, + readonly experimental_safeAreaInsets?: ?WindowSafeAreaInsets, }; export type DimensionsPayload = { diff --git a/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js b/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js index cbd60b5e99b0..c21cfe91c69d 100644 --- a/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js +++ b/packages/rn-tester/js/examples/SafeAreaInsets/SafeAreaInsetsExample.js @@ -23,6 +23,7 @@ import { StyleSheet, TextInput, View, + useWindowDimensions, } from 'react-native'; type Insets = SafeAreaInsetsChangeEvent['nativeEvent']['insets']; @@ -273,6 +274,25 @@ function ScrollBenchmark(): React.Node { ); } +function WindowInsetsExample(): React.Node { + const { + width, + height, + experimental_safeAreaInsets: safeAreaInsets, + } = useWindowDimensions(); + + return ( + + {`window: {width: ${width}, height: ${height}}`} + + {safeAreaInsets == null + ? 'safeAreaInsets: not available' + : `safeAreaInsets: {top: ${safeAreaInsets.top}, right: ${safeAreaInsets.right}, bottom: ${safeAreaInsets.bottom}, left: ${safeAreaInsets.left}}`} + + + ); +} + const styles = StyleSheet.create({ readout: { backgroundColor: '#ffaaaa', @@ -356,4 +376,10 @@ exports.examples = [ 'Rows observing their own insets inside a scroll view. Scrolling moves the rows, so observing rows may emit inset events while crossing safe area boundaries.', render: (): React.Node => , }, + { + title: 'Window safe area insets from Dimensions', + description: + 'The `Dimensions` module reports the safe area insets of the window, available synchronously at startup.', + render: (): React.Node => , + }, ] as Array; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index bf2f13fb4f71..048ddab520b5 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -3990,6 +3990,16 @@ struct facebook::react::NativeIntersectionObserverNativeIntersectionObserverEntr public bool operator==(const facebook::react::NativeIntersectionObserverNativeIntersectionObserverEntry& other) const; } +template +struct facebook::react::NativeDeviceInfoDisplayMetricsAndroid { + public P0 width; + public P1 height; + public P2 scale; + public P3 fontScale; + public P4 densityDpi; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetricsAndroid& other) const; +} + template struct facebook::react::NativeIntersectionObserverNativeIntersectionObserverObserveOptions { public P0 intersectionObserverId; @@ -4013,13 +4023,12 @@ struct facebook::react::NativeResizeObserverNativeResizeObserverEntry { } template -struct facebook::react::NativeDeviceInfoDisplayMetricsAndroid { +struct facebook::react::NativeDeviceInfoDisplayMetrics { public P0 width; public P1 height; public P2 scale; public P3 fontScale; - public P4 densityDpi; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetricsAndroid& other) const; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; } template @@ -4052,12 +4061,12 @@ struct facebook::react::NativeDeviceInfoDimensionsPayload { } template -struct facebook::react::NativeDeviceInfoDisplayMetrics { - public P0 width; - public P1 height; - public P2 scale; - public P3 fontScale; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsets { + public P0 top; + public P1 right; + public P2 bottom; + public P3 left; + public bool operator==(const facebook::react::NativeDeviceInfoWindowSafeAreaInsets& other) const; } template @@ -4762,6 +4771,17 @@ struct facebook::react::NativeDeviceInfoDisplayMetricsBridging { public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); } +template +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsetsBridging { + public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); + public static T types; + public static double bottomToJs(facebook::jsi::Runtime& rt, decltype(types.bottom) value); + public static double leftToJs(facebook::jsi::Runtime& rt, decltype(types.left) value); + public static double rightToJs(facebook::jsi::Runtime& rt, decltype(types.right) value); + public static double topToJs(facebook::jsi::Runtime& rt, decltype(types.top) value); + public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); +} + template struct facebook::react::NativeDialogManagerAndroidDialogOptionsBridging { public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index cd0d11b73b71..f7374c09a899 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -3983,6 +3983,16 @@ struct facebook::react::NativeIntersectionObserverNativeIntersectionObserverEntr public bool operator==(const facebook::react::NativeIntersectionObserverNativeIntersectionObserverEntry& other) const; } +template +struct facebook::react::NativeDeviceInfoDisplayMetricsAndroid { + public P0 width; + public P1 height; + public P2 scale; + public P3 fontScale; + public P4 densityDpi; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetricsAndroid& other) const; +} + template struct facebook::react::NativeIntersectionObserverNativeIntersectionObserverObserveOptions { public P0 intersectionObserverId; @@ -4006,13 +4016,12 @@ struct facebook::react::NativeResizeObserverNativeResizeObserverEntry { } template -struct facebook::react::NativeDeviceInfoDisplayMetricsAndroid { +struct facebook::react::NativeDeviceInfoDisplayMetrics { public P0 width; public P1 height; public P2 scale; public P3 fontScale; - public P4 densityDpi; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetricsAndroid& other) const; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; } template @@ -4045,12 +4054,12 @@ struct facebook::react::NativeDeviceInfoDimensionsPayload { } template -struct facebook::react::NativeDeviceInfoDisplayMetrics { - public P0 width; - public P1 height; - public P2 scale; - public P3 fontScale; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsets { + public P0 top; + public P1 right; + public P2 bottom; + public P3 left; + public bool operator==(const facebook::react::NativeDeviceInfoWindowSafeAreaInsets& other) const; } template @@ -4715,6 +4724,13 @@ struct facebook::react::NativeDeviceInfoDisplayMetricsBridging { public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); } +template +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsetsBridging { + public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); + public static T types; + public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); +} + template struct facebook::react::NativeDialogManagerAndroidDialogOptionsBridging { public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index cd0d11b73b71..f7374c09a899 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -3983,6 +3983,16 @@ struct facebook::react::NativeIntersectionObserverNativeIntersectionObserverEntr public bool operator==(const facebook::react::NativeIntersectionObserverNativeIntersectionObserverEntry& other) const; } +template +struct facebook::react::NativeDeviceInfoDisplayMetricsAndroid { + public P0 width; + public P1 height; + public P2 scale; + public P3 fontScale; + public P4 densityDpi; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetricsAndroid& other) const; +} + template struct facebook::react::NativeIntersectionObserverNativeIntersectionObserverObserveOptions { public P0 intersectionObserverId; @@ -4006,13 +4016,12 @@ struct facebook::react::NativeResizeObserverNativeResizeObserverEntry { } template -struct facebook::react::NativeDeviceInfoDisplayMetricsAndroid { +struct facebook::react::NativeDeviceInfoDisplayMetrics { public P0 width; public P1 height; public P2 scale; public P3 fontScale; - public P4 densityDpi; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetricsAndroid& other) const; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; } template @@ -4045,12 +4054,12 @@ struct facebook::react::NativeDeviceInfoDimensionsPayload { } template -struct facebook::react::NativeDeviceInfoDisplayMetrics { - public P0 width; - public P1 height; - public P2 scale; - public P3 fontScale; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsets { + public P0 top; + public P1 right; + public P2 bottom; + public P3 left; + public bool operator==(const facebook::react::NativeDeviceInfoWindowSafeAreaInsets& other) const; } template @@ -4715,6 +4724,13 @@ struct facebook::react::NativeDeviceInfoDisplayMetricsBridging { public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); } +template +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsetsBridging { + public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); + public static T types; + public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); +} + template struct facebook::react::NativeDialogManagerAndroidDialogOptionsBridging { public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index b2cee85173bf..bad1c4ba9b64 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -6012,6 +6012,15 @@ struct facebook::react::NativeResizeObserverNativeResizeObserverEntry { public bool operator==(const facebook::react::NativeResizeObserverNativeResizeObserverEntry& other) const; } +template +struct facebook::react::NativeDeviceInfoDisplayMetrics { + public P0 width; + public P1 height; + public P2 scale; + public P3 fontScale; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +} + template struct facebook::react::NativeExceptionsManagerStackFrame { public P0 column; @@ -6042,12 +6051,12 @@ struct facebook::react::NativeDeviceInfoDimensionsPayload { } template -struct facebook::react::NativeDeviceInfoDisplayMetrics { - public P0 width; - public P1 height; - public P2 scale; - public P3 fontScale; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsets { + public P0 top; + public P1 right; + public P2 bottom; + public P3 left; + public bool operator==(const facebook::react::NativeDeviceInfoWindowSafeAreaInsets& other) const; } template @@ -6696,6 +6705,17 @@ struct facebook::react::NativeDeviceInfoDisplayMetricsBridging { public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); } +template +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsetsBridging { + public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); + public static T types; + public static double bottomToJs(facebook::jsi::Runtime& rt, decltype(types.bottom) value); + public static double leftToJs(facebook::jsi::Runtime& rt, decltype(types.left) value); + public static double rightToJs(facebook::jsi::Runtime& rt, decltype(types.right) value); + public static double topToJs(facebook::jsi::Runtime& rt, decltype(types.top) value); + public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); +} + template struct facebook::react::NativeExceptionsManagerExceptionDataBridging { public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); @@ -9312,6 +9332,25 @@ struct JS::NativeDeviceInfo::DisplayMetrics::Builder::Input { protected RCTRequired width; } +struct JS::NativeDeviceInfo::WindowSafeAreaInsets { + protected NSDictionary* unsafeRawValue() const; + protected static JS::NativeDeviceInfo::WindowSafeAreaInsets fromUnsafeRawValue(NSDictionary* const v); +} + +struct JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder { + protected Builder(JS::NativeDeviceInfo::WindowSafeAreaInsets i); + protected Builder(const JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder::Input i); + protected NSDictionary* buildUnsafeRawValue() const; + protected using ResultT = JS::NativeDeviceInfo::WindowSafeAreaInsets; +} + +struct JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder::Input { + protected RCTRequired bottom; + protected RCTRequired left; + protected RCTRequired right; + protected RCTRequired top; +} + struct JS::NativeExceptionsManager::ExceptionData { protected ExceptionData(NSDictionary* const v); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index 14908f165160..a123572f354d 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -5997,6 +5997,15 @@ struct facebook::react::NativeResizeObserverNativeResizeObserverEntry { public bool operator==(const facebook::react::NativeResizeObserverNativeResizeObserverEntry& other) const; } +template +struct facebook::react::NativeDeviceInfoDisplayMetrics { + public P0 width; + public P1 height; + public P2 scale; + public P3 fontScale; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +} + template struct facebook::react::NativeExceptionsManagerStackFrame { public P0 column; @@ -6027,12 +6036,12 @@ struct facebook::react::NativeDeviceInfoDimensionsPayload { } template -struct facebook::react::NativeDeviceInfoDisplayMetrics { - public P0 width; - public P1 height; - public P2 scale; - public P3 fontScale; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsets { + public P0 top; + public P1 right; + public P2 bottom; + public P3 left; + public bool operator==(const facebook::react::NativeDeviceInfoWindowSafeAreaInsets& other) const; } template @@ -6646,6 +6655,13 @@ struct facebook::react::NativeDeviceInfoDisplayMetricsBridging { public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); } +template +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsetsBridging { + public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); + public static T types; + public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); +} + template struct facebook::react::NativeExceptionsManagerExceptionDataBridging { public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); @@ -9163,6 +9179,25 @@ struct JS::NativeDeviceInfo::DisplayMetrics::Builder::Input { protected RCTRequired width; } +struct JS::NativeDeviceInfo::WindowSafeAreaInsets { + protected NSDictionary* unsafeRawValue() const; + protected static JS::NativeDeviceInfo::WindowSafeAreaInsets fromUnsafeRawValue(NSDictionary* const v); +} + +struct JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder { + protected Builder(JS::NativeDeviceInfo::WindowSafeAreaInsets i); + protected Builder(const JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder::Input i); + protected NSDictionary* buildUnsafeRawValue() const; + protected using ResultT = JS::NativeDeviceInfo::WindowSafeAreaInsets; +} + +struct JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder::Input { + protected RCTRequired bottom; + protected RCTRequired left; + protected RCTRequired right; + protected RCTRequired top; +} + struct JS::NativeExceptionsManager::ExceptionData { protected ExceptionData(NSDictionary* const v); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index ea827a36dd01..0639e1452f14 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -6005,6 +6005,15 @@ struct facebook::react::NativeResizeObserverNativeResizeObserverEntry { public bool operator==(const facebook::react::NativeResizeObserverNativeResizeObserverEntry& other) const; } +template +struct facebook::react::NativeDeviceInfoDisplayMetrics { + public P0 width; + public P1 height; + public P2 scale; + public P3 fontScale; + public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +} + template struct facebook::react::NativeExceptionsManagerStackFrame { public P0 column; @@ -6035,12 +6044,12 @@ struct facebook::react::NativeDeviceInfoDimensionsPayload { } template -struct facebook::react::NativeDeviceInfoDisplayMetrics { - public P0 width; - public P1 height; - public P2 scale; - public P3 fontScale; - public bool operator==(const facebook::react::NativeDeviceInfoDisplayMetrics& other) const; +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsets { + public P0 top; + public P1 right; + public P2 bottom; + public P3 left; + public bool operator==(const facebook::react::NativeDeviceInfoWindowSafeAreaInsets& other) const; } template @@ -6654,6 +6663,13 @@ struct facebook::react::NativeDeviceInfoDisplayMetricsBridging { public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); } +template +struct facebook::react::NativeDeviceInfoWindowSafeAreaInsetsBridging { + public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); + public static T types; + public static facebook::jsi::Object toJs(facebook::jsi::Runtime& rt, const T& value, const std::shared_ptr& jsInvoker); +} + template struct facebook::react::NativeExceptionsManagerExceptionDataBridging { public static T fromJs(facebook::jsi::Runtime& rt, const facebook::jsi::Object& value, const std::shared_ptr& jsInvoker); @@ -9171,6 +9187,25 @@ struct JS::NativeDeviceInfo::DisplayMetrics::Builder::Input { protected RCTRequired width; } +struct JS::NativeDeviceInfo::WindowSafeAreaInsets { + protected NSDictionary* unsafeRawValue() const; + protected static JS::NativeDeviceInfo::WindowSafeAreaInsets fromUnsafeRawValue(NSDictionary* const v); +} + +struct JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder { + protected Builder(JS::NativeDeviceInfo::WindowSafeAreaInsets i); + protected Builder(const JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder::Input i); + protected NSDictionary* buildUnsafeRawValue() const; + protected using ResultT = JS::NativeDeviceInfo::WindowSafeAreaInsets; +} + +struct JS::NativeDeviceInfo::WindowSafeAreaInsets::Builder::Input { + protected RCTRequired bottom; + protected RCTRequired left; + protected RCTRequired right; + protected RCTRequired top; +} + struct JS::NativeExceptionsManager::ExceptionData { protected ExceptionData(NSDictionary* const v);