2
votes

I'm having an issue with CellMeasurer in conjunction with scrollToIndex on a List. If I set scrollToIndex to some large value (presumably any index corresponding to a row preceded by rows that haven't been measured yet), and then I scroll upwards, the scroll seems to reset back to it's original position repeatedly. Eventually it starts resetting higher and higher up, until eventually I've made my way back to the start of the list.

Relevant Plunker--it's a list with 300 elements (all the same static height so CellMeasurer isn't necessary but it illustrates my problem), and I set scrollToIndex to 150. Try scrolling upward.

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

Understandably the scroll might not be perfectly smooth since the calculations are based on predicted heights and they're not always going to be correct (in practice at least--in this case they will be correct), but this seems particularly bad/unintended. I suspect (and hope) that I'm doing something incorrectly here--would appreciate any thoughts. Thanks.

EDIT:

On my MBP this happens in both Chrome and Firefox, though it looks slightly different depending on which browser I'm using. On Windows, using Chrome, there is some weird flashing of different rows while scrolling up, but it doesn't seem to reset back to 150 at least.

EDIT:

Here's a gif of the issue occurring - this is on Chrome 60.0.3112.113, Mac OS Sierra 10.12.6:

1
@andrew...sometimes it works fine... - MukulSharma
@MukulSharma - what browser and OS? - andrew
i checked in googleChrome - MukulSharma
For what it's worth, it works fine for me in Chrome+Safari+Firefox (on Mac OS). - bvaughn
@brianvaughn very strange. So you're scrolling upward (viewing rows with values lower than 150) with no stuttering? I'm able to reproduce on Mac OS Sierra in Safari, Firefox, and Chrome, on Windows in Firefox and Chrome, on Chrome OS 59 in Chrome, and on iOS 10.3.3 in Chrome and Safari. Are you able to try more browser/OS/machine combinations to try to reproduce this? Appreciate any help. Thanks. - andrew

1 Answers