Flipkart / recyclerlistview

High performance listview for React Native and web!
Apache License 2.0
5.17k stars 420 forks source link

Bugfix(layoutSize) fix item not render after initial data size is empty #781

Closed shawnchendev closed 2 weeks ago

shawnchendev commented 1 month ago

This PR address two issues

Issue 1

this will fix flash-list issue https://github.com/Shopify/flash-list/issues/784

if layoutSize is provided, items doesn't render if the initial data size is empty.

add new function to componentCompact to allow extended component to had access to the _hasRenderOnce

only assign the state is the component never get render before

Here is the screen capture i had for the Shopify POS that reproduce the issue

BEFORE

https://github.com/Flipkart/recyclerlistview/assets/17916546/dfc443b3-93e7-479c-b82b-f93d2a7fa719

AFTER

https://github.com/Flipkart/recyclerlistview/assets/17916546/d1ba3998-ec04-45b7-a2e2-8aacec95e253

Issue 2

after fixing issue 1, when navigate to the list. the content size will increase by the estimatedItemSize

here is the screenshot and video demo on SHOPIFY POS on the issue

image

https://github.com/Flipkart/recyclerlistview/assets/17916546/68504344-f83a-43a6-9d28-f4013e989a41