fix(ios): let a scroll view's background reach the safe-area inset - #77
Open
CodyPChristian wants to merge 1 commit into
Open
fix(ios): let a scroll view's background reach the safe-area inset#77CodyPChristian wants to merge 1 commit into
CodyPChristian wants to merge 1 commit into
Conversation
A ScrollView is laid out inside the safe area, so a background declared on it stops short of the home indicator and the window shows through — a band of systemBackground behind the tab bar on an otherwise themed screen. List does not have this problem: ListBackgroundModifier already does .scrollContentBackground(.hidden).background(...), which extends through the inset. So the same screen built on a <list> looks right and one built on a <scroll-view> does not, and the workaround becomes rebuilding screens around a list to fix what is really a paint bug. Give the scroll view the same reach. Gated on the node actually declaring a background, so a scroll view that never asked for one is untouched and keeps the system default.
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.
The bug
A
ScrollViewis laid out inside the safe area, so a background declared on it stops short of the home indicator and the window shows through — a band ofsystemBackgroundbehind the tab bar on an otherwise fully themed screen.Listdoesn't have this problem.ListBackgroundModifieralready does:content .scrollContentBackground(.hidden) .background(Color(argb: argb))which extends through the inset. So the same screen built on a
<list>renders correctly and one built on a<scroll-view>doesn't — and the workaround people land on is rebuilding screens around a list to fix what is really a paint bug.The fix
ScrollViewBackgroundModifier, applied to the threeScrollViewchains, giving them the same reach as the list:content .scrollContentBackground(.hidden) .background(Color(argb: argb).ignoresSafeArea())Gated on
node.style?.bgColor(with the samedark_bg_colorprecedence the list modifier uses), so a scroll view that never declared a background is untouched and keeps the system default.Scope
Verified
Built and run on an iOS 26 simulator against a themed app. Before: a list-based tab root rendered clean while a scroll-view tab root kept a black band behind the tab bar. After: they match, with the theme colour running edge to edge. Screens with no declared background are unchanged.
Related
Same family as #76 (clearing the List row fill so a declared list background actually shows). Independent of it — different renderer, no overlap — but they're both "a declared background doesn't reach where it should".