Certain combinations of height, itemSize, and itemCount parameters can cause the "center" mode of scrollToItem to behave incorrectly. In this example sandbox, clicking the "scroll to 41" button consistently scrolls item 41 out of view (tested in chrome)
Certain combinations of height, itemSize, and itemCount parameters can cause the "center" mode of
scrollToItem
to behave incorrectly. In this example sandbox, clicking the "scroll to 41" button consistently scrolls item 41 out of view (tested in chrome)https://codesandbox.io/s/react-window-center-scroll-bug-29r22j?file=/src/App.tsx
We appear to be hitting this case when we shouldn't be: https://github.com/bvaughn/react-window/blob/51ec3f896e7501acd6f399c759047781112fadf0/src/FixedSizeList.js#L69
though I don't understand that function well enough to see exactly where it's going wrong.