Skip to content

feature: honour gradient backgrounds and add transparent on native:list (iOS) - #64

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/list-transparent-scroll-background
Open

feature: honour gradient backgrounds and add transparent on native:list (iOS)#64
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/list-transparent-scroll-background

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Aug 23, 2026

Copy link
Copy Markdown
Member

What's wrong

On iOS, native:list always paints the system grey (systemGroupedBackground) behind its rows. #35 fixed that when the list has a flat bg-* colour, but two cases still show grey:

  • the list has a gradient background (bg-gradient-to-b …)
  • the list should be see-through so the screen behind it shows — and bg-transparent can't say that, it encodes as "no colour"

Android never had this problem (LazyColumn draws no background), so the same Blade looks right on Android and grey on iOS.

What this does

  • A list with a gradient now shows it.
  • New transparent attribute (<native:list transparent> / ->transparent()), like plain: the list paints nothing, the screen shows through. No-op on Android.
  • Lists without either are unchanged.
  • Adds tests/ListTest.php (first tests for native:list).
<native:column class="w-full h-full bg-gradient-to-b from-theme-background-soft to-theme-background">
    <native:list class="w-full flex-1" transparent>
        <native:list-section header="Today">…</native:list-section>
    </native:list>
</native:column>

Before/after screenshots in a comment below. Docs (edge-components/list) need one line for transparent — happy to PR that too.

NativePHP#35 taught the iOS List renderer to hide SwiftUI's system grouped
background when the node declares a flat `bg-*` colour. Two cases still
fall through to the stock grey:

1. A gradient (`bg-gradient-to-b from-* via-* to-*`) — the node's
   NodeStyleModifier paints it, but `ListBackgroundModifier` only looks
   at `bgColor`, so the List keeps covering it.
2. A list meant to sit directly on the screen's own background (a
   gradient screen, an image, the background layer). `bg-transparent`
   cannot express this — it packs to the same 0 as "no colour".

Extend the modifier to hide the scroll background when the node carries
`gradient_stops`, and add a `transparent` list attribute / fluent
`->transparent()` (mirroring `plain`) for the second case. Neither paints
anything in the renderer: whatever the node or the screen draws shows
through. Lists without a gradient or the attribute are unchanged.

Android's LazyColumn draws no background of its own, so the attribute is
a no-op there; sticky section headers keep their opaque fill so rows
don't bleed through while pinned.

Claude-Session: https://claude.ai/code/session_016JiGXkjVzeaBeZa165N2Xk
@SRWieZ

SRWieZ commented Aug 23, 2026

Copy link
Copy Markdown
Member Author

Before and after
imageSimulator Screenshot - iPhone 17 - 2026-08-23 at 16 58 54

@SRWieZ SRWieZ changed the title Honour gradient backgrounds and add transparent on native:list (iOS) feature: honour gradient backgrounds and add transparent on native:list (iOS) Aug 24, 2026
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