Open alexco2 opened 2 years ago
Good catch. I'll look into fixing this soon.
You can actually skip memoizing renderItem
with separators. The list's update logic doesn't depend on reference of this callback. I'll fix it anyway in the future.
My solution is to skip memorization as well as I already thought it is unnecessary anyway. I guess a short note in the docs would be enough. Good to know that the update logic is not affected though.
@alexco2 Well there is an impact but it's limited to pagination. When you add more data to the list as of now it skips updating items that are already there. This is the reason why separator is not updating. I need to find a way to update the last item.
@naqvitalha thank you for the explanation :)
Memoizing the renderItem
function also causes the items to not be re-rendered when a dependency changes.
Are there any updates on this problem?
is there any update?
Current behavior
When loading in items in an infinitive scroll list (with
onEndReached
), the top mostItemSeperator
of the item that is loaded in is not rendered. When scrolling away from the not renderedItemSeperator
and back again, theItemSeperator
is loaded in again correctly. The problem is with renderItem being memoized in auseCallback
. Is that even necessary since the cells get reused anyway? If not, the fix is quite simple, but perhaps it should be mentioned in the docs.Expected behavior
ItemSeperator should be rendered initially.
To Reproduce
Platform:
Environment
1.0.4