[iOS] Make scrollToEnd include adjusted content inset#57523
Conversation
|
Hi @eliotgevers! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
Fixes #57522.
ScrollView.scrollToEnd()currently computes its iOS Fabric endpoint fromUIScrollView.contentInset. When UIKit supplies safe-area or bar adjustments throughadjustedContentInset, the command stops before the same endpoint a user can reach by dragging.This change uses
adjustedContentInsetwhen constructing the vertical or horizontal end target. It also adds a focused native regression test with a 100-point viewport, 200-point content height, zero raw inset, and a 20-point adjusted bottom inset.scrollToEnd()must finish at offset 120.This is related to, but distinct from, #56189. That PR moves general
scrollToclamping intoscrollToOffsetand usesadjustedContentInset; however,scrollToEnd()still constructs an already-valid but too-small target from rawcontentInset, so the later clamp does not increase it.The public reproduction starts from the official React Native reproducer template and does not use Expo, navigation, a keyboard, or an explicit
contentInset:https://github.com/eliotgevers/react-native-scroll-to-end-adjusted-inset-repro
Changelog:
[IOS] [FIXED] - Make
ScrollView.scrollToEnd()include system-adjusted content insetsTest Plan:
Tested on an iPhone 17 Pro Max simulator running iOS 26.5 with React Native compiled from source.
scrollToEnd()scrollTo({y: 9999})The 34-point difference equals the simulator's adjusted bottom safe-area inset.
Focused RNTester regression test:
The test was run through
RNTesterPods.xcworkspace, schemeRNTester, with:Local RNTester harness note
Current
mainlocally hit an unrelated compile error inRCTTurboModuleArrayBufferTests.mm(detail::OwnedBytesBufferis not declared by that file's imports). I temporarily excluded that existing test source from the local focused build so this new test could compile and run. That exclusion is not included in this PR.