Comments (11)
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 (usingtotalListHeightChanged
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). 🤔
from react-virtuoso.
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!
from react-virtuoso.
Hey,
this is not supported currently, I am afraid. Technically, it should be fairly easy to build such variation of the component, reusing the same engine but rendering in a different manner. I can help with directions In case you are interested in contributing such implementation.
Thanks!
from react-virtuoso.
Thanks I may have a look at implementing it in the future.
from react-virtuoso.
The workaround zsee posted seems to work if you have list that takes up the entire height of the viewport.
However, I don't believe it's possible to do with a GroupedVirtuoso if you have anything above the list as it calculates the top margin for the sticky group header by calculating the top offset, and it appears to only do that calculation when scrolling has stopped, so it will overshoot the top while scrolling and jump back down when done scrolling. In the below video I added position: sticky
to Hello World.
Anyone have any ideas on how to make this work?
from react-virtuoso.
🎉 This issue has been resolved in version 1.3.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from react-virtuoso.
@petyosi Does the window scrolling functionality only work with the list? Because I tried to use it with the grid component and I get this:
Warning: React does not recognize the
useWindowScroll
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercaseusewindowscroll
instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in div (created by VirtuosoScroller)
in VirtuosoScroller (created by GridRoot)
in GridRoot (created by ForwardRef)
from react-virtuoso.
@mciszczon I have not ported it to the grid yet. Likely going to do that soon, but no concrete ETA.
from react-virtuoso.
@mciszczon I have not ported it to the grid yet. Likely going to do that soon, but no concrete ETA.
Thanks @petyosi, I'm looking forward for it and will have your package on the radar. I'm afraid I'll not be able to help you with this too much, but what I can tell you is that it's really not that simple to make a virtualized grid in React. I've already used react-list
and react-virtualized
but both of these have some issues to them which are not trivial to fix.
Anyway, thanks for the reply and keep up the great work! 👍🏻
from react-virtuoso.
@mciszczon the window scrolling implementation of the grid won't differ from the current one, except for the missing scroller. If you would like to share the challenges you are facing with grids react-list and react-virtualized (maybe open a discussion?) I would be more than happy to review and comment. Thank you!
from react-virtuoso.
Hello @petyosi, This library is great!
I am wondering if you had any thoughts on how I might get the scroll bar off the content?
Below is a screenshot of the corner where I have changed our margins to padding around the GroupedVirtuoso and the scrollbar is over the content.
i think we can live with this, but i figured i would touch base here to see if there's a way to get all the same great functionality but with a scroll bar that would respect the padding for the look i'm going for.
PS: I'm also looking for a way to put padding between groups, check this screenshot
thanks
from react-virtuoso.
Related Issues (20)
- How to specify a row in Virtuoso List so that it does not unload when scrolling HOT 2
- [BUG] `restoreStateFrom` appears to have a race condition when restoring state on component mount HOT 8
- React Virtuoso Message List - ref.current.scrollToItem based on the item.data instead of using the item index?
- [BUG] npm run browse-examples HOT 1
- [BUG] Simple header breaks restore state location HOT 3
- [BUG] When used in MUI's Tooltip component, extra white space will appear. HOT 1
- Chrome52 is not compatible HOT 1
- [BUG] Grid jittering/flickering HOT 1
- [BUG] VirtuosoGrid - endReached doesn't call if data set is less then the container HOT 1
- Drag the scrolllbar makes the grid blink in Firefox, but not in Chromium or Edge... HOT 1
- [BUG] react-beautiful-dnd + useWindowScroll HOT 1
- [BUG] followOutput doesn't scroll to bottom HOT 2
- [BUG] element disappearing when reverse scrolling in the ios HOT 4
- [BUG]After packaging a project that uses react-virtuoso, there is a problem embedding it into the iframe of another domain name HOT 2
- [BUG] `InitialTopMostItemIndex` causes variable height elements to blink/jump when scrolling up. HOT 1
- [BUG] Border does not get respected with fixed headers HOT 3
- Drag and drop not working as intended on mobile devices when using react-beautiful-dnd with react-virtuoso HOT 2
- [BUG] followOutput does not scroll al the way to bottom HOT 3
- [BUG] (virtuoso-message-list) strange scrolling on ipad HOT 2
- [BUG] Inability to use a flex container as a parent or to customize viewport
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-virtuoso.