Skip to content

fix(core): iOS scrollToVerticalOffset lands past the offset when there is a content inset - #11409

Open
NathanWalker wants to merge 1 commit into
mainfrom
fix/ios-scroll-to-offset-insets
Open

NathanWalker wants to merge 1 commit into
mainfrom
fix/ios-scroll-to-offset-insets

Conversation

@NathanWalker

Copy link
Copy Markdown
Contributor

ScrollView.scrollToVerticalOffset and scrollToHorizontalOffset on iOS asked UIKit to scroll a viewport-sized rect into view (scrollRectToVisible with CGRect(0, value, bounds.width, bounds.height)). With a bottom (or right) content inset, that rect cannot fit in the visible area, so UIKit aligns its far edge instead and the scroll ends contentInset.bottom past the requested offset. Any scroll view that keeps a content inset for a docked bar, a keyboard, or iosContentInsetAdjustmentBehavior gets this.

Fix

Set contentOffset directly, clamped to the range a user scroll can reach (-adjustedContentInset.top up to contentSize + adjustedContentInset.bottom - bounds), for both orientations. This also matches Android, which already sets the scroll position directly.

…e is a content inset

Both scrollTo*Offset methods asked UIKit to scroll a viewport-sized rect
into view. With a bottom (or right) content inset that rect cannot fit in
the visible area, so UIKit aligned its far edge instead and the scroll
ended contentInset.bottom past the requested offset — a chat scrolling to
its last message with a docked composer inset overshot by the inset every
time. The offset is now set directly, clamped to the range a user scroll
can reach, which also matches what Android does.
@nx-cloud

nx-cloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 00a192f

Command Status Duration Result
nx run-many -t build -p core,webpack5,vite ✅ Succeeded 25s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-02 18:19:38 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11409
npm i https://pkg.pr.new/@nativescript/vite@11409
npm i https://pkg.pr.new/@nativescript/webpack@11409

commit: 00a192f

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant