Repository navigation
Conversation
6c44668 to
6b290c9
Compare
| * the content container by the insets, so content is laid out clear of the | ||
| * system UI, such as the rail on iPhone Duo or camera cutout in landscape, | ||
| * while the container's background still extends edge to edge. | ||
| * while the container's background still extends edge to edge. On every |
There was a problem hiding this comment.
Nit: The docs say contentContainerStyle padding counts toward the inset “on every edge,” but percentage padding intentionally bypasses this calculation. Could we qualify this as point-valued padding or mention the percentage-padding exception?
There was a problem hiding this comment.
Yeah let me follow this up 👍🏻👍🏻
There was a problem hiding this comment.
Thanks for adding the detailed percentage-padding behavior below — that addresses the underlying nuance. One small follow-up: this sentence still says the padding counts toward the inset “on every edge,” which remains slightly over-broad because percentage padding across the scrollable axis intentionally bypasses the safe-area padding. Could we qualify this sentence as point-valued/pixel padding too?
cipolleschi
left a comment
There was a problem hiding this comment.
Looks good overall. The inset calculation, RTL handling, native state propagation, and test coverage are sound. I left one non-blocking documentation nit.
|
@huntie-bot Pick to 0.89 and 0.88 when merged. Assume #59194 is successfully picked first, by explicitly stating this dependency in the pick request with an |
Pull Request is not mergeable
|
Just to set expectations, we can't pick these changes in 0.88 because it will be a breaking change. |
…content view Summary: Brings two internal fixes to GitHub that ShipIt did not export, resolving part of the DiffTrain sync drift on `main`: - Add `getVerticalBarEdge` to the unsupported-platform `RCTStatusBarManager` stub, returning `nil`, so it conforms to the native module spec on tvOS after react#59237. - Declare `RCTScrollContentViewCls` with `RCT_EXTERN` in `RCTScrollContentViewComponentView.h`, matching its component registration linkage (part of the internal import of react#59836). Changelog: [Internal] Test Plan: Both changes are already landed and built internally (tvOS, iOS and macOS). The resulting files match the internal copies.
… and tab bars ## Summary **Context** Follow-up to #59836, which is on `0.89-stable`. **Problem** With `contentInsetAdjustmentBehavior`, #59836 lays out each edge at the larger of the `contentContainerStyle` padding and the safe area inset. This is ideal for iPhone Duo / iPhone landscape horizontal insets. **However**, for the scrollable axis (when vertical), UIKit's inset also covers any system navigation bar, tab bar or toolbar the scroll view sits under. In this case, absorbing padding smaller than the bar is **unexpected** — a screen under a native stack header (react-native-screens, Expo Router) or above a tab bar loses its top or bottom padding. (Below image is a mock explainer): <img width="760" alt="Mock of iPhone Duo under a solid header: in 0.89.0-rc the list sits flush against the header, with this diff it sits 16 pt below" src="https://github.com/user-attachments/assets/5a017e02-1837-4285-afd0-1bfd7332598a" /> **This diff** Apply the larger-of rule along the scrollable axis **only** on an edge where the window's safe area (the status bar, sensor housing or home indicator) ***alone*** makes up the inset. Where a bar adds to it, the padding adds on top, as in earlier releases: | Vertical ScrollView, `automatic` | 0.88 | 0.89.0-rc | This diff | |---|---|---|---| | Full screen under dynamic island only, 16 pt padding | 59 + 16⚠️ | larger of the two ✅ | larger of the two | | Under a navigation bar, 16 pt padding | bar + 16 | bar + 0 ❌ | ✅ bar + 16 | | Above a tab bar | bar + padding | absorbed ❌ | ✅ bar + padding | | Above the home indicator only | 34 + padding⚠️ | larger of the two ✅ | larger of the two | | Beside the iPhone Duo side bar, 16 pt padding | 16, under the side bar ❌ | larger of the two ✅ | larger of the two | | iPhone in landscape, beside the Dynamic Island, 16 pt padding | inset + 16 ❌ | larger of the two ✅ | larger of the two | **Phrased another way**: Auto-positioning under a system header turns off inset vs padding behaviour. For vertical, this would now only take effect for a full screen view. ScrollViews not against the system edges (e.g. already in a SafeAreaView or under an opaque custom header), are **unchanged**. **Changes** - Across the scrollable axis, unchanged: the larger of the padding and the whole safe area, such as the side bar on iPhone Duo. - Clarify the `contentInsetAdjustmentBehavior` and `contentContainerStyle` docs to match. Changelog: [iOS][Fixed] - **ScrollView**: With `contentInsetAdjustmentBehavior`, `contentContainerStyle` padding adds to an inset that includes a navigation bar, tab bar or toolbar, instead of being absorbed by it ## Test Plan Set up temporarily in RNTester: the full screen ScrollView example under a native navigation bar, with 20 pt padding (green). (**Ignore** white gap above the navigation bar, this is a separate Duo bug.) | iPhone Duo folded, before | after | |---|---| | <img src="https://github.com/user-attachments/assets/dd242b39-940d-489c-8fcb-a7d68504409b" width="300" /> | <img src="https://github.com/user-attachments/assets/7740f26f-d0ce-420f-b19a-6b485cc94d51" width="300" /> | | ❌ The navigation bar inset absorbs the padding, so the content sits flush against the bar | ✅ The 20 pt padding adds below the bar | - `RCTScrollViewComponentView.mm` compiles in an RNTester simulator build. - `ScrollContentViewTest.cpp`: added `keepsColumnPaddingBelowANavigationBar`. Differential Revision: D133527191 Pull Request resolved: #60163
… and tab bars ## Summary **Context** Follow-up to #59836, which is on `0.89-stable`. **Problem** With `contentInsetAdjustmentBehavior`, #59836 lays out each edge at the larger of the `contentContainerStyle` padding and the safe area inset. This is ideal for iPhone Duo / iPhone landscape horizontal insets. **However**, for the scrollable axis (when vertical), UIKit's inset also covers any system navigation bar, tab bar or toolbar the scroll view sits under. In this case, absorbing padding smaller than the bar is **unexpected** — a screen under a native stack header (react-native-screens, Expo Router) or above a tab bar loses its top or bottom padding. (Below image is a mock explainer): <img width="760" alt="Mock of iPhone Duo under a solid header: in 0.89.0-rc the list sits flush against the header, with this diff it sits 16 pt below" src="https://github.com/user-attachments/assets/5a017e02-1837-4285-afd0-1bfd7332598a" /> **This diff** Apply the larger-of rule along the scrollable axis **only** on an edge where the window's safe area (the status bar, sensor housing or home indicator) ***alone*** makes up the inset. Where a bar adds to it, the padding adds on top, as in earlier releases: | Vertical ScrollView, `automatic` | 0.88 | 0.89.0-rc | This diff | |---|---|---|---| | Full screen under dynamic island only, 16 pt padding | 59 + 16⚠️ | larger of the two ✅ | larger of the two | | Under a navigation bar, 16 pt padding | bar + 16 | bar + 0 ❌ | ✅ bar + 16 | | Above a tab bar | bar + padding | absorbed ❌ | ✅ bar + padding | | Above the home indicator only | 34 + padding⚠️ | larger of the two ✅ | larger of the two | | Beside the iPhone Duo side bar, 16 pt padding | 16, under the side bar ❌ | larger of the two ✅ | larger of the two | | iPhone in landscape, beside the Dynamic Island, 16 pt padding | inset + 16 ❌ | larger of the two ✅ | larger of the two | **Phrased another way**: Auto-positioning under a system header turns off inset vs padding behaviour. For vertical, this would now only take effect for a full screen view. ScrollViews not against the system edges (e.g. already in a SafeAreaView or under an opaque custom header), are **unchanged**. **Changes** - Across the scrollable axis, unchanged: the larger of the padding and the whole safe area, such as the side bar on iPhone Duo. - Clarify the `contentInsetAdjustmentBehavior` and `contentContainerStyle` docs to match. Changelog: [iOS][Fixed] - **ScrollView**: With `contentInsetAdjustmentBehavior`, `contentContainerStyle` padding adds to an inset that includes a navigation bar, tab bar or toolbar, instead of being absorbed by it ## Test Plan Set up temporarily in RNTester: the full screen ScrollView example under a native navigation bar, with 20 pt padding (green). (**Ignore** white gap above the navigation bar, this is a separate Duo bug.) | iPhone Duo folded, before | after | |---|---| | <img src="https://github.com/user-attachments/assets/dd242b39-940d-489c-8fcb-a7d68504409b" width="300" /> | <img src="https://github.com/user-attachments/assets/7740f26f-d0ce-420f-b19a-6b485cc94d51" width="300" /> | | ❌ The navigation bar inset absorbs the padding, so the content sits flush against the bar | ✅ The 20 pt padding adds below the bar | - `RCTScrollViewComponentView.mm` compiles in an RNTester simulator build. - `ScrollContentViewTest.cpp`: added `keepsColumnPaddingBelowANavigationBar`. Differential Revision: D133527191 Pull Request resolved: #60163 (cherry picked from commit c652e84)
Summary
Context
Optional but intended follow-up to #59194.
#59194 fixed the documented behaviour of
ScrollView/FlatListcontentInsetAdjustmentBehaviorby handling safe area padding across the scrollable axis, such as the rail on iPhone Duo and the notch on a regular iPhone in landscape.Now that this works, there's a further detail on Duo which reveals a bug/misbehaviour with
contentInsetAdjustmentBehaviorhandling and inner content padding.This diff
Proposes a further update to
contentInsetAdjustmentBehaviorand how it interacts with padding set bycontentContainerStyle.Key change: Moves from an add padding approach to max of padding or safe area, per edge.
Illustrated — ScrollView with 20px content padding all sides +
contentInsetAdjustmentBehavior="auto"The aim is to make React Native's scroll views work intuitively.
Implementation notes
Changelog:
[iOS][Fixed] - ScrollView:
contentInsetAdjustmentBehaviornow pads content by the larger of the safe area orcontentContainerStylepadding. Previously, it added the two.Test Plan
RNTester, ScrollView > Content Inset Adjustment Behavior