When using CellMeasurer and scrollToIndex at the same time (on a List), scrolling upward seems to be broken. Explained in more detail here:
Plunker:
It actually seems that there are two distinct issues here:
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 #610.
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 #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).
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
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?
Most helpful comment
It actually seems that there are two distinct issues here:
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 #610.
Independent of that, when you use the
scrollToIndexprop on a list that also usesCellMeasurer, the list seems to repeatedly jump back to the specified index (maybe whenever cells are measured?), as if the list seems to think that thescrollToIndexprop changed (and thus it must scroll to the new value) even though it has not. This issue is briefly mentioned in #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 callingList.scrollToRow()instead of setting thescrollToIndexprop. 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).