bvaughn / react-window

React components for efficiently rendering large lists and tabular data
https://react-window.now.sh/
MIT License
15.48k stars 778 forks source link

add new item error when use VariableSizeList #762

Open 2239559319 opened 3 months ago

2239559319 commented 3 months ago

How to reproduce?

Go to this codesandbox, click add

What is the expectation?

The list increases after clicking add button, list should be 0 to 5

What actually happened?

0 1 and 2 item lost

ches4117 commented 1 hour ago

Your numbers disappear because you use ref?.current?.scrollTo((newData.length - 1) * 37);, You could try to use ref?.current?.scrollTo(0);, or shorten the List height like height={100}, it will be scrollable.