react-native-big-list icon indicating copy to clipboard operation
react-native-big-list copied to clipboard

Question: onViewableItemsChanged support?

Open zchwyng opened this issue 3 years ago • 7 comments

Do you plan on adding onViewableItemsChanged prop or similar, for detecting which items are currently visible?

zchwyng avatar Jun 15 '21 15:06 zchwyng

Hi @zchwyng , added at the moment and I need to do some tests before release it. Probably on next days after some tests I will release it.

On the other hand viewabilityConfig property would not be of any help in this library because the logic behind is completly different.

marcocesarato avatar Jun 15 '21 22:06 marcocesarato

Cool. I really like to test this as a RecyclerList replacement :)

zchwyng avatar Jun 16 '21 07:06 zchwyng

Added on 1.3.8 as experimental feature. Let me know if you have any problems if you find a problem report what it returns and what it should return.

marcocesarato avatar Jun 16 '21 22:06 marcocesarato

I've done some initial testing on iOS, and am having an issue where handleViewableItemsChanged doesn't trigger for the first item in the list. (I'm having a header that's higher than the device, so the first item isn't visible at first.) It also just gives me the latest viewable item in viewableItems even though I'm expecting two items currently visible. Could be something wrong on my end though... Other than that it looks really good!

zchwyng avatar Jun 19 '21 21:06 zchwyng

Also it seems like it stops rendering the header when renderEmpty is applied.

zchwyng avatar Jun 20 '21 13:06 zchwyng

Hi @zchwyng

I've done some initial testing on iOS, and am having an issue where handleViewableItemsChanged doesn't trigger for the first item in the list. (I'm having a header that's higher than the device, so the first item isn't visible at first.) It also just gives me the latest viewable item in viewableItems even though I'm expecting two items currently visible. Could be something wrong on my end though... Other than that it looks really good!

This should be solved on 1.3.12.

Also it seems like it stops rendering the header when renderEmpty is applied.

This was intentional. Anyway I changed it and now as default the header and footer are visibile even with empty item and I added some props to let hide marginals header and footer on empty.

Note: The empty element, if you render the header and footer, can no longer be stylized with "flex: 1" but is only "height: auto", so if you need to change the height, you need to specify it without using percentages or flex.

marcocesarato avatar Jun 20 '21 15:06 marcocesarato

The viewabilityConfig will be great, on my system i have a screen like reels and with this great package the videos start when it's not on the screen because the couple pixels. With this option we can set viewAreaCoveragePercentThreshold :50 and will works very well

Thank you

brunolcarlos avatar Feb 27 '22 01:02 brunolcarlos