hyochan / flat_list

Flutter's [FlatList] widget for React Native friendly developers
MIT License
10 stars 3 forks source link

onRefresh not triggered when items fit in viewport #5

Closed brysem closed 1 year ago

brysem commented 1 year ago

Description

First of all amazing package! Love the functionality. I am running into one small issue though.

The FlatList onRefresh is not fired when the list is smaller than the viewport of the screen. As soon as the list has more items than fits inside the viewport, the onRefresh behavior works as expected.

Expected Behavior

I expect to see the RefreshIndicator and the code inside onRefresh executed.

Environment:

To Reproduce Steps to reproduce the behavior:

  1. Create a flatlist with 1 item that fits entirely within the viewport.
  2. Add an onRefresh callback with a print.
  3. Try dragging down. It should not be possible.
  4. The onRefresh callback is not called.
hyochan commented 1 year ago

Hi @brysem ! Thanks for the issue. Could you kindly push a reproducible example as FlatList Example 6 after forking the repository?

Screenshot 2023-03-15 at 11 57 55 PM

I'll try to investigate the problem after that.

brysem commented 1 year ago

Thanks for the quick reply.

I created an example 6 in my fork. https://github.com/brysem/flat_list/commit/1c3499d468aa3aea461852f682b0d6ea0dc7ae16 image

Observations:

  1. onRefresh does not work when the total amount of items all fit inside the viewport OR the list is empty.
  2. onEndReached does not work when the total amount of items all fit inside the viewport.

Please let me know if I can be of anymore help.

brysem commented 1 year ago

I decided to have a go at fixing the issue myself. Please see https://github.com/hyochan/flat_list/pull/6 I apologize for the auto formatting.