Add scrollToIndex support for WindowScroller
See original GitHub issueI has been reported that Grid
does not support the scrollToIndex
property when used with WindowScroller
. Let’s investigate if it is possible to add support for this use case.
cc @tiberiumaxim: If you have questions, we can discuss them here or on Gitter.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
scrollToIndex doesn't work with WindowScroller - Stack Overflow
Does scrollToIndex works with WindowScroller? because I only found ... Since version 9.8.0, WindowScroller supports scrollToIndex prop.
Read more >Getting Started with React Virtuoso | React Virtuoso
Add the Component to your application. ... The Virtuoso components provide an imperative scrollToIndex method with an optional align that scrolls the ...
Read more >React Native scrollToIndex - Dynamic size item scroll inside ...
In this video tutorial you will learn about React Native scrollToIndex and how to scroll to an item inside a FlatList, ListView, ScrollView, ......
Read more >react-virtualized
Collection; Grid; List; Masonry; Table. ArrowKeyStepper; AutoSizer; CellMeasurer; ColumnSizer; InfiniteLoader; MultiGrid; ScrollSync; WindowScroller ...
Read more >react-virtualized/CHANGELOG and react-virtualized Releases ...
WindowScroller supports scrollToIndex prop. ... Added prop-types dependency to avoid deprecation warnings for React 15.5+.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, the problem you’ll have to solve in order to implement this feature basically boils down to this:
Normally a user scrolls within a
Grid
;Grid
listens to scroll events and updates what it displays. When a user sets a prop likescrollToIndex
-Grid
determines what the offset of that row would be and updates the scroll position so that it’s visible.WindowScroller
changes the rules a bit. Its purpose is to enable a page to scroll outside ofGrid
so that other page elements can scroll too. It listens to scroll events and tellsGrid
which offset it should display visible data at.The problem is this:
WindowScroller
is listening to thewindow
object for scroll events. When you set ascrollToIndex
prop,Grid
updates its own scroll offset (and then renders new rows).WindowScroller
isn’t listening toGrid
and so the page isn’t scrolled to show the newly rendered rows.I haven’t thought much about this problem because, as I mentioned previously, I don’t use
WindowScroller
. 😄Unfortunately I don’t have time to really dig into or think about this at the moment. I’d welcome a contribution if you’d like to dig into it and submit a PR, but I don’t have the bandwidth to offer any architectural guidance on it. Sorry!