fix: render the trailing switch on iOS list items - #68
Open
SRWieZ wants to merge 1 commit into
Open
Conversation
`trailingSwitch()` set trailing_type=switch, but the iOS renderer's
switch case was an EmptyView stub ("handled at a higher level" — no
such level exists), so the row silently rendered nothing. Android has
always drawn a Material Switch here.
Render a real SwiftUI Toggle with local state and the same
echo-prevention sync as NativeUIToggleRenderer, reporting through the
row's on_trailing_change callback with a bool payload — exactly what
Android sends.
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
Give a list item a trailing switch:
On Android you get a Material Switch. On iOS you get nothing — the row renders with an empty trailing slot, no error anywhere.
Why
In
NativeUIListItemRenderer.swift, the trailingswitchcase was a stub:There is no "higher level" — nothing else ever renders it.
The fix
Render a real SwiftUI
Toggle, following the exact patternNativeUIToggleRendereralready uses:@State, so the thumb animates instantly on tap.primarycolor, like every other switch.on_trailing_changecallback — the same payload Android has always sent, so one PHP handler works on both platforms.No Android changes, no PHP changes, no API changes —
trailingSwitch()simply starts working on iOS.