Skip to content

fix(ios): clear the List row fill so a declared list background shows - #76

Open
CodyPChristian wants to merge 1 commit into
NativePHP:mainfrom
CodyPChristian:fix/ios-list-row-background
Open

fix(ios): clear the List row fill so a declared list background shows#76
CodyPChristian wants to merge 1 commit into
NativePHP:mainfrom
CodyPChristian:fix/ios-list-row-background

Conversation

@CodyPChristian

Copy link
Copy Markdown
Contributor

The bug

ListBackgroundModifier hides the grouped scroll background when a list node declares one:

content
    .scrollContentBackground(.hidden)
    .background(Color(argb: argb))

But SwiftUI also gives every row an opaque system fill, and that paints over the list's background. So <list class="bg-theme-background"> still renders as a white sheet, with the declared colour visible only in the thin strips above the first row and below the last.

The effect is that a themed list-based screen looks broken next to an otherwise-identical scroll-view-based one.

The fix

One line in rowView():

.listRowBackground(Color.clear)

The row becomes transparent, so the list's declared background shows through, and each row still paints whatever its own content declares (a card, a surface colour, nothing).

Scope

  • Only affects lists that declare a backgroundListBackgroundModifier is already a no-op otherwise, so the stock grouped look is unchanged for everyone else.
  • Android is unaffected: Compose has no implicit row fill, and ListRenderer.kt already draws MaterialTheme.colorScheme.background.

Verified

Built and run on an iOS 26 simulator against a themed app: a <list> screen now matches its <scroll-view> equivalent, rows still render their own card backgrounds, and separators/swipe actions are unchanged.

ListBackgroundModifier hides the grouped scroll background when a list node
declares one, but SwiftUI also gives every row an opaque system fill. That
row fill paints over the list's background, so `<list class="bg-...">`
still rendered as a white sheet with the declared colour visible only at the
very top and bottom edges.

Clearing the row background lets the list's colour show while each row still
paints whatever its own content declares.

Android is unaffected: Compose has no implicit row fill.
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