Skip to content

fix: only attach iOS pull-to-refresh when the list declares on-refresh - #71

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:fix/ios-list-refreshable-only-with-handler
Open

fix: only attach iOS pull-to-refresh when the list declares on-refresh#71
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:fix/ios-list-refreshable-only-with-handler

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Aug 24, 2026

Copy link
Copy Markdown
Member

The bug

Every native:list on iOS offers pull-to-refresh — including static settings screens and forms. Pull down and a spinner appears, spins, and does nothing.

Why

The renderer applies .refreshable unconditionally; the on_refresh check lives inside the closure:

.refreshable {
    if onRefreshCb != 0 { ... }
}

That guards the callback, but SwiftUI installs the refresh control (spinner included) the moment .refreshable is attached — whether or not the closure does anything. The Android renderer already gates its whole PullToRefreshBox on onRefreshCb != 0, so the two platforms disagree.

The fix

Move the check outside: a conditional modifier attaches .refreshable only when the list declares an on-refresh handler. Lists without one scroll plainly, matching Android and the dedicated native:refreshable element's opt-in contract. Behavior with a handler is unchanged.

.refreshable was applied unconditionally, so every native:list — static
settings screens and forms included — offered a pull-down spinner that
did nothing. Gate the modifier on the on_refresh callback id, matching
the Android renderer, which already wraps its PullToRefreshBox in the
same check.
@SRWieZ SRWieZ changed the title iOS: only attach pull-to-refresh when the list declares on-refresh fix: only attach iOS pull-to-refresh when the list declares on-refresh 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