question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-virtualized WindowScroller alternative?

See original GitHub issue

Is there anyway to achieve what WindowScroller does in react-virtuoso? I’m looking to create a Twitter/Facebook style news feed where you use the native window scrollbars to scroll an infinite list (or in my case, grid). Thanks in advance.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
zseecommented, Feb 12, 2020

Hi! Good job on react-virtuoso! It seems like a nice library 👍

I tried to achieve something similar to WindowScroller. It seems to be doable with these things / workarounds:

  • Custom scroll container which reports and sets the window’s scroll position ± offsetTop of the scroll container.
  • Detection of position changes for the list. (eg. an element above disappears). Not sure how to this correctly, so -> polling offsetTop
  • To limit the number of items rendered a maxHeight: "100vh" was added to the first div of the scroll container.
  • Set a minHeight on Virtuoso so something is initially rendered. After that set the height to the total list height (using totalListHeightChanged for this).

https://stackblitz.com/edit/react-pgd1ms

Would it be possible to add something to the library to make this easier? I think adding the maxHeight: "100vh" shouldn’t be an issue, and maybe also adding a prop that forces the initial rendering of some elements (so minHeight wouldn’t be needed). 🤔

6reactions
petyosicommented, Jan 20, 2021

I took my time with this feature, but hopefully, this will help whoever finds this issue 😃.

https://virtuoso.dev/window-scrolling/ - post some feedback here if you give it a try. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-virtualized Alternatives - React Infinite Scroll | LibHunt
Here are some online demos of each component: ArrowKeyStepper · AutoSizer · CellMeasurer · Collection · ColumnSizer · Grid · InfiniteLoader ...
Read more >
A super simple alternative to react-virtualized or react-window ...
A super simple alternative to react-virtualized or react-window to get smooth scrolling in your React app. by Angus Russell.
Read more >
An alternative to react-virtualized | by Matt Colman | Medium
A virtualized list works by only rendering rows that are visible on screen, and ignoring the rest. react-virtualized is the big one in...
Read more >
react-virtualized combined with WindowScroller and AutoSizer ...
Therefore I'm using WindowScroller and Autosizer. I can scroll down the whole list of 70 items but it stops rendering after 30 list...
Read more >
List Virtualization - Patterns.dev
You can fetch/display more items as the user scrolls, unloading previous entries and replacing them with new ones. A smaller alternative to react-virtualized...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found