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
By using the useWindowVirtualizer hook to apply virtualization for list items with different heights in relation to window scrolling, when you scroll, the virtualization behavior will occur.
Items that no longer need to be rendered will disappear from the DOM, and the list items corresponding to the visible indices will begin to appear in the DOM.
On Mobile iOS Safari, momentum scrolling triggered by user gestures works, but when combined with virtualization, the momentum effect fails to end smoothly and instead stutters or breaks abruptly. Is there a way to resolve this issue?
It seems that the CodeSandbox link is difficult to run on Mobile iOS Safari at the moment. However, you can reproduce the issue by running the attached source code.
Terms & Code of Conduct
I agree to follow this project's Code of Conduct
I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
The text was updated successfully, but these errors were encountered:
I'm no expert here, so take my findings with a pinch of salt
When an element is first "mounted" the size is measured, if the element is a different size from expected it will adjust the scroll position to hide this. Safari appears to only preserve a momentum scroll when doing this if it is the same direction, e.g. if currently scrolling down and I set the scroll to an earlier position, it will cancel it.
If you are dynamically measuring your elements, it's recommended to estimate the largest possible size (width/height, within comfort) of your items. This will ensure features like smooth-scrolling will have a better chance at working correctly
The key for me was that I was implementing a message view which scrolls up by default, this flips the logic round and instead the estimate needs to be smaller than possible. Then when the user scrolls back down it will have already measured the elements and everything will work "correctly".
Describe the bug
By using the useWindowVirtualizer hook to apply virtualization for list items with different heights in relation to window scrolling, when you scroll, the virtualization behavior will occur.
Items that no longer need to be rendered will disappear from the DOM, and the list items corresponding to the visible indices will begin to appear in the DOM.
On Mobile iOS Safari, momentum scrolling triggered by user gestures works, but when combined with virtualization, the momentum effect fails to end smoothly and instead stutters or breaks abruptly. Is there a way to resolve this issue?
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/qhkvyz
Steps to reproduce
Expected behavior
I hope to maintain a seamless momentum scroll experience.
How often does this bug happen?
Every time
Screenshots or Videos
KakaoTalk_Video_2024-11-22-11-28-21.mp4
2024-11-22.11.58.26.mov
Platform
tanstack-virtual version
v3.10.6
TypeScript version
v5.4.5
Additional context
It seems that the CodeSandbox link is difficult to run on Mobile iOS Safari at the moment. However, you can reproduce the issue by running the attached source code.
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: