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

When scrolling up, items are not rendered in advance #49

Open
timavaza opened this issue Jul 14, 2018 · 4 comments
Open

When scrolling up, items are not rendered in advance #49

timavaza opened this issue Jul 14, 2018 · 4 comments

Comments

@timavaza
Copy link

Hi there,

I notice that the behaviour scrolling up seems different from scrolling down.
Often when scrolling down, there's a threshold of pre-loaded items below the container so that there's fewer instances of a blank white container. However when scrolling back up, you frequently see a blank container as it seems the items aren't preloaded.

Also would be good if there were options to specify the number of items rendered above & below the visible container.

Nice tool!
Thanks!

@illbredmiscreant
Copy link

illbredmiscreant commented Aug 11, 2018

I was running into this issue too, and I believe I have the fix for this, which is a single line of code.

(on ../lib/index.js) Change line 92 from:
if (!lastRepaint || diff < 0 || diff > this._averageHeight) {
to
if (!lastRepaint || Math.abs(scrollTop - lastRepaint) > 0) {

The comparison to averageHeight prevents this from rendering while scrolling up if the scroll doesn't exceed the averageHeight value.

@timavaza
Copy link
Author

Hi Joe,
I found that fix didn't work for us.. as you scroll a list back up, up to half the list still goes white...
Thanks for trying though.. maybe our scenario's a little different to yours.

@phayman
Copy link

phayman commented Jun 6, 2024

Same for me, the above fix didn't work

@cellcrowd
Copy link

Change
this._cachedItemsLen = Math.max(this._cachedItemsLen || 0, this._screenItemsLen * 3);
to
this._cachedItemsLen = Math.max(this._cachedItemsLen || 0, this._screenItemsLen * 4);

Change
while (this._itemPositions[i] < scrollTop) {
to
while (this._itemPositions[i] < scrollTop - this._containerSize) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants