If I have a list with enough elements to be able to scroll, I scroll down and then clear the list, then the onScroll event is triggered after reducing the items number, which shouldn't happen.
Click the button "Clear list" to reduce the number of items
An alert is popping out to notify that the onScroll has been triggered and the "Scrolled to the top" criteria is met
Note: as a criteria for scrolling to the top I check for the props to have scrollUpdateWasRequested === false && props.scrollDirection === "backward" && props.scrollOffset === 0
If I have a list with enough elements to be able to scroll, I scroll down and then clear the list, then the onScroll event is triggered after reducing the items number, which shouldn't happen.
I have made an example here where you can see the issue: https://codesandbox.io/s/elastic-bush-o1s8ec?file=/index.js
Replication steps:
onScroll
has been triggered and the "Scrolled to the top" criteria is metNote: as a criteria for scrolling to the top I check for the props to have
scrollUpdateWasRequested === false && props.scrollDirection === "backward" && props.scrollOffset === 0