Skip to content

fix(gallery-native): enable pull to refresh when gallery is empty - #736

Open
stelselim wants to merge 2 commits into
mainfrom
fix/gallery-native-empty-pull-to-refresh
Open

stelselim wants to merge 2 commits into
mainfrom
fix/gallery-native-empty-pull-to-refresh

Conversation

@stelselim

Copy link
Copy Markdown
Contributor

Checklist

  • Contains unit tests ✅
  • Contains breaking changes ❌
  • Did you update version and changelog? Changelog ✅ (under Unreleased), version ❌
  • PR title properly formatted ([XX-000]: description)? ❌ — ticket number to be added
  • Works in Android — not yet verified on device
  • Works in iOS — not yet verified on device
  • Works in Tablet — not yet verified on device

This PR contains

  • Bug fix

What is the purpose of this PR?

When the Gallery widget has no items and only shows the empty placeholder, pull to refresh does not work.

Relevant changes

FlashList holds the refresh control (onRefresh / refreshing), but it is only rendered when there are items. With an empty list, the placeholder was rendered in a plain View that can't scroll, so there was nothing to pull.

When the gallery scrolls vertically and has a pull down action, the empty placeholder is now wrapped in a ScrollView with a RefreshControl. That control uses the same pullDown / pullDownIsExecuting props as the list. contentContainerStyle={{ flexGrow: 1 }} makes the whole placeholder area pullable. Horizontal galleries, and galleries without a pull down action, render the placeholder as before.

Also added:

  • A unit test checking that pulling down on an empty gallery calls the pull down action
  • A changelog entry under Unreleased

What should be covered while testing?

  • Vertical gallery with a pull down action and an empty datasource: pulling down shows the refresh indicator and runs the action
  • Once items appear, pull to refresh still works on the populated list
  • Empty placeholder layout and sizing are unchanged, especially when the gallery sits in a parent without a fixed height
  • Horizontal gallery and galleries without a pull down action are unaffected

Extra comments (optional)

Two snapshot tests for the load more button (alpha: null in the Android ripple) already fail on main. They are unrelated to this change and were left as is.

🤖 Generated with Claude Code

When the gallery had no items, only the empty placeholder was rendered in a
plain View and FlashList (which owns the refresh control) was not mounted,
so pull to refresh could not be triggered. Wrap the placeholder in a
ScrollView with a RefreshControl for vertical galleries with a pull down
action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stelselim
stelselim requested a review from a team as a code owner November 25, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants