Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll stutters/resets when using CellMeasurer with scrollToIndex on a List #803

Closed
athorwall opened this issue Sep 5, 2017 · 4 comments

Comments

@athorwall
Copy link

When using CellMeasurer and scrollToIndex at the same time (on a List), scrolling upward seems to be broken. Explained in more detail here:

https://stackoverflow.com/questions/45993421/react-virtualized-scrolltoindex-not-working-with-cellmeasurer

Plunker:

https://plnkr.co/edit/XPF5D88WI9CErhkmrgAy?p=preview

@raffy2010
Copy link

#610 should be the same problem

@athorwall
Copy link
Author

athorwall commented Sep 6, 2017

It actually seems that there are two distinct issues here:

  1. If you scroll upward toward unmeasured cells, then once the cells are measured the cells after them will jump down to accommodate the newly measured cells above them. The severity of the effect is related to the difference between a cell's default size and the actual size. This seems to be a very challenging issue to solve, and I think it's the focus of Dynamic height + scrolling up (when the upper cells aren't loaded yet) #610.

  2. Independent of that, when you use the scrollToIndex prop on a list that also uses CellMeasurer, the list seems to repeatedly jump back to the specified index (maybe whenever cells are measured?), as if the list seems to think that the scrollToIndex prop changed (and thus it must scroll to the new value) even though it has not. This issue is briefly mentioned in Dynamic height + scrolling up (when the upper cells aren't loaded yet) #610 but is mostly ignored--intuitively it seems like it's probably much easier to solve. At the very least, it seems like we can workaround this issue by calling List.scrollToRow() instead of setting the scrollToIndex prop. Example: https://plnkr.co/edit/8V4AtlqPtELrmDQMgBr7?p=preview (click "CLICK ME" and it will scroll to row 150; then attempt to scroll up and it should work fine).

@SeanSassenrath
Copy link

Using this for now. Thanks @athorwall

At the very least, it seems like we can workaround this issue by calling List.scrollToRow() instead of setting the scrollToIndex prop

@DavidCary
Copy link

This seems to be another issue that was at least partially addressed in version 20.1. This plunker example:

https://plnkr.co/edit/UDbO2KKjQ3neDok0EOah?p=preview

is a fork of the example mentioned above, but with updated React and RV libraries. It seems to work unless the RV version is 20.0 or less.

Are there still cases that are not working with a current version of RV?

@github-actions github-actions bot added the Stale label Oct 15, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants