From b7b7d754f1aeb7b2b2eea218750a307267e67500 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 | 18 +++++-- .../modules/deviceinfo/DeviceInfoModule.kt | 22 +++++++- .../react/coremodules/DeviceInfoModule.h | 11 +++- .../modules/NativeDeviceInfo.js | 21 ++++++++ .../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, 359 insertions(+), 56 deletions(-) diff --git a/packages/react-native/Libraries/Utilities/Dimensions.js b/packages/react-native/Libraries/Utilities/Dimensions.js index 13458dd737db..a2222868cf77 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 + ? undefined + : { + 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..a391b9fc50c5 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -202,12 +202,24 @@ 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 = @{ + NSMutableDictionary *dimsWindow = [@{ @"width" : @(windowSize.width), @"height" : @(windowSize.height), @"scale" : @(screen.scale), - @"fontScale" : @(fontScale) - }; + @"fontScale" : @(fontScale), + } mutableCopy]; + // The field is documented as absent when it cannot be measured; without a + // window there are no insets to report, and zero would read as a + // measurement. + if (mainWindow != nil) { + UIEdgeInsets safeAreaInsets = mainWindow.safeAreaInsets; + dimsWindow[@"experimental_safeAreaInsets"] = @{ + @"top" : @(safeAreaInsets.top), + @"right" : @(safeAreaInsets.right), + @"bottom" : @(safeAreaInsets.bottom), + @"left" : @(safeAreaInsets.left) + }; + } NSDictionary *dimsScreen = @{ @"width" : @(screenSize.width), 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..c905f7737cf7 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,11 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) : WritableNativeMap().apply { putMap( "windowPhysicalPixels", - getPhysicalPixelsWritableMap(getWindowDisplayMetrics()), + getPhysicalPixelsWritableMap(getWindowDisplayMetrics()).apply { + getWindowSafeAreaInsetsWritableMap()?.let { + putMap("experimental_safeAreaInsets", it) + } + }, ) putMap( "screenPhysicalPixels", @@ -91,6 +96,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..50566f2ffe4b 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,26 @@ 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, + /** + * The part of the window that is covered by the system UI, in physical + * pixels. Absent on platforms and versions that cannot report it. + * + * @experimental + */ + readonly experimental_safeAreaInsets?: WindowSafeAreaInsets, }; export type DisplayMetrics = { @@ -25,6 +39,13 @@ export type DisplayMetrics = { height: number, scale: number, fontScale: number, + /** + * The part of the window that is covered by the system UI, in physical + * pixels. Absent on platforms and versions that cannot report it. + * + * @experimental + */ + 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 0520c4ef20a7..bb9f4cf117d0 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 03b3c6162649..44a2f2c907a0 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -8581,6 +8581,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; @@ -8604,13 +8614,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 @@ -8643,12 +8652,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 @@ -9411,6 +9420,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 0e9b0ea3333c..0d719a5c2da9 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -8341,6 +8341,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; @@ -8364,13 +8374,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 @@ -8403,12 +8412,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 @@ -9131,6 +9140,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 dfe9f0a12715..5e5ac4d5a7dd 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -8572,6 +8572,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; @@ -8595,13 +8605,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 @@ -8634,12 +8643,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 @@ -9362,6 +9371,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 51d2c233601e..0d15eb0a052a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -10558,6 +10558,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; @@ -10588,12 +10597,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 @@ -11300,6 +11309,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); @@ -15903,6 +15923,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 a161c2e65bcc..15f5086cccdd 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -10374,6 +10374,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; @@ -10404,12 +10413,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 @@ -11081,6 +11090,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); @@ -15582,6 +15598,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 b32ab36d78a7..94d0836c521a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -10549,6 +10549,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; @@ -10579,12 +10588,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 @@ -11256,6 +11265,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); @@ -15757,6 +15773,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);