Skip to content

Apply safe area insets RTL-aware in RNTester and helloworld (#59645) - #59645

Open
Abbondanzo wants to merge 2 commits into
react:mainfrom
Abbondanzo:export-D128337176
Open

Abbondanzo wants to merge 2 commits into
react:mainfrom
Abbondanzo:export-D128337176

Conversation

@Abbondanzo

@Abbondanzo Abbondanzo commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

RNTester's platform test results view and the helloworld app pad themselves from experimental_onSafeAreaInsetsChange, mapping insets.left/insets.right straight to paddingLeft/paddingRight. Insets are physical edges, but Yoga treats paddingLeft/paddingRight as start/end when swapLeftAndRightInRTL is on, so in RTL a right-edge cutout was left unpadded while the left edge got its padding. Both callers now swap the left and right insets in that case, as the internal SafeAreaView already does.

Also updates the LogBox inspector, inspector footer and inspector header Fantom snapshots for the internal SafeAreaView's wrapper view.

Changelog:
[Internal]

Reviewed By: andrewdacenko

Differential Revision: D128337176

…t#58112)

Summary:
The private `SafeAreaView` used by LogBox, the element inspector and `InputAccessoryView` now pads its children from the `experimental_onSafeAreaInsetsChange` prop instead of wrapping the native `RCTSafeAreaView`. It also works on Android, where it was a plain `View` before.

The callers that still used the deprecated public `SafeAreaView` move off it: RNTester's platform test results view and the helloworld app use the insets prop, typed with `SafeAreaInsets`, which is now exported alongside `SafeAreaInsetsChangeEvent`. LogBox's inspector header drops its Android-only `View` fallback.

The native view is left in place for the deprecated public `SafeAreaView`; react#58113 removes it.

## Changelog:

[ANDROID] [FIXED] - LogBox, the element inspector and `InputAccessoryView` now apply safe area padding on Android

[GENERAL] [ADDED] - Export the `SafeAreaInsets` type

Pull Request resolved: react#58112

Test Plan:
```
yarn test packages/react-native/Libraries/LogBox   # 101 passed, 3 snapshots updated
yarn flow-check                                    # 0 errors
```

LogBox notification, LogBox inspector and element inspector on iOS and Android, plus `InputAccessoryView` on iOS:

| | LogBox notification | LogBox inspector | Element inspector | |
|---|---|---|---|---|
| iOS | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/ios-logbox-notification.png" width="200"> | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/ios-logbox-inspector.png" width="200"> | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/ios-inspector.png" width="200"> | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/ios-iav-keyboard.png" width="200"><br>`InputAccessoryView` |
| Android | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/android-logbox-notification.png" width="200"> | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/android-logbox-inspector.png" width="200"> | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/android-inspector.png" width="200"> | <img src="https://raw.githubusercontent.com/janicduplessis/react-native/cf6fa5bb55818587767eb6b47a10b8970864f932/android-inspector-top.png" width="200"><br>Element inspector, panel at the top |

 ---

👉 1. react#58112 — Render the internal SafeAreaView from the safe area insets prop
    2. react#58113 — Remove the native SafeAreaView and the deprecated public export

Differential Revision: D126071736

Pulled By: Abbondanzo
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 29, 2026
@meta-codesync

meta-codesync Bot commented Oct 29, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128337176.

@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

)

Summary:
Pull Request resolved: react#59645

RNTester's platform test results view and the helloworld app pad themselves from `experimental_onSafeAreaInsetsChange`, mapping `insets.left`/`insets.right` straight to `paddingLeft`/`paddingRight`. Insets are physical edges, but Yoga treats `paddingLeft`/`paddingRight` as start/end when `swapLeftAndRightInRTL` is on, so in RTL a right-edge cutout was left unpadded while the left edge got its padding. Both callers now swap the left and right insets in that case, as the internal `SafeAreaView` already does.

Also updates the LogBox inspector, inspector footer and inspector header Fantom snapshots for the internal `SafeAreaView`'s wrapper view.

Changelog:
[Internal]

Reviewed By: andrewdacenko

Differential Revision: D128337176
@meta-codesync meta-codesync Bot changed the title Apply safe area insets RTL-aware in RNTester and helloworld Apply safe area insets RTL-aware in RNTester and helloworld (#59645) Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants