You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial offset to apply to the virtualizer. This is usually only useful if you are rendering the virtualizer in a SSR environment.
I don't know if this feature is broken in v3.0.0-beta.4, but it has no effect on the rendered view.
Context
We use a virtualiser to break down the overview of audio waveforms. A 3 minute waveform will have 8 million samples (or pixels).
Simple Case
User can scroll along their project, and we want the scroll position to remain between sessions.
So ideally we can give the virtualiser an initial offset (in pixels).
We could do this with scrollToOffset, but that means initial rendering at 0, and another rendering at the desired offset.
Note: Even if done in useLayoutEffect, calling scrollToOffset seems to be triggering an additional render phase. This makes a lot of sense as it isn't just the scroll position that changes - new items have to be rendered as well.
Complex Case
Our app offers zoom functionality. When the user zoom in (or out), the amount of columns changes and a complete re-render of the cells is needed.
Here again, we want to be able to keep the content centred. Example:
Given:
The user has zoom 1 (100%)
Scrolls to pixel 1000
Viewport is 1000 pixel wide
The centre of the viewport is pixel 1500.
When:
The user zooms out (zoom 2, or 200%)
What was at pixel 1500 is now at pixel 750
Since the viewport is 1000 pixel wide...
... we want to scroll the user to pixel 250 (start) or 750(centre).
Again, we can do this in useLayoutEffect, but that means double-rendering (before and after scroll). So the view "flickers".
Request
It would be nice if when the scrollOffset property changes, the virtualiser would account for that in the next render AND scroll the parent to that offset.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The documentation for
initialOffset
says:I don't know if this feature is broken in v3.0.0-beta.4, but it has no effect on the rendered view.
Context
We use a virtualiser to break down the overview of audio waveforms. A 3 minute waveform will have 8 million samples (or pixels).
Simple Case
User can scroll along their project, and we want the scroll position to remain between sessions.
So ideally we can give the virtualiser an initial offset (in pixels).
We could do this with
scrollToOffset
, but that means initial rendering at 0, and another rendering at the desired offset.Note: Even if done in
useLayoutEffect
, callingscrollToOffset
seems to be triggering an additional render phase. This makes a lot of sense as it isn't just the scroll position that changes - new items have to be rendered as well.Complex Case
Our app offers zoom functionality. When the user zoom in (or out), the amount of columns changes and a complete re-render of the cells is needed.
Here again, we want to be able to keep the content centred. Example:
Given:
When:
Again, we can do this in
useLayoutEffect
, but that means double-rendering (before and after scroll). So the view "flickers".Request
It would be nice if when the
scrollOffset
property changes, the virtualiser would account for that in the next render AND scroll the parent to that offset.Beta Was this translation helpful? Give feedback.
All reactions