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:
|
return 0; // near the beginning |
though I don't understand that function well enough to see exactly where it's going wrong.