Repository navigation
[Masterclass] Clear the home indicator with a content margin, not a spacer row - #237
Open
shrutibalasawebdev wants to merge 1 commit into
Open
shrutibalasawebdev wants to merge 1 commit into
shrutibalasawebdev wants to merge 1 commit into
Conversation
A bottom-anchored scroll view ended its content with a spacer row the height of the home indicator, collapsing it while the keyboard is up. Inside the LazyVStack, that row is placed from the estimated heights of the rows above it, and resizing it with the keyboard changes the content while the keyboard re-pin is scrolling. Pins to the bottom anchor then landed short of the real end: - A single wrapping column (one very tall lazy row) opened blank until dragged, and blanked out when the keyboard showed or hid. - With messages as direct children, new messages no longer kept the view at the bottom. Apply the same clearance as a bottom content margin instead. Nothing inside the lazy stack changes, and the margin collapses with the keyboard as the spacer did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016kqQGZ2V3NpkyywRHYfDYh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #234
Problem
Since #141, a bottom-anchored scroll view ends its content with a spacer row the height of the home indicator, collapsing it to 0 while the keyboard is up. That row lives inside the
LazyVStack, just before the bottom anchor.In a lazy stack, a row is placed from the estimated heights of the rows above it. So the spacer and the anchor after it sit where SwiftUI guesses, and pins to the anchor land there. Resizing the spacer with the keyboard also changes the content while the keyboard re-pin is scrolling. The result, on iOS:
<scroll-view scroll-anchor="bottom">with oneh-full justify-endcolumn holding the messages) opens blank until you drag, and blanks out when the keyboard shows or hides. (#ISSUE_NUMBER)Fix
Apply the same clearance as a bottom content margin instead of a spacer row:
Nothing inside the lazy stack is estimated or resized for it anymore, and the margin collapses with the keyboard exactly as the spacer did. Everything else in #141 is unchanged.
Testing
On an iOS simulator, with a demo app and with a real chat app, both on this branch:
Android isn't affected: this file is iOS only.