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
{{ message }}
This repository was archived by the owner on Oct 1, 2021. It is now read-only.
Some 1d collections need bi-directional infinite scrolling. A good example is a calendar that is initialized with today's date but allows the user to view past dates. Allowing negative indexes would be one way to implement this. Where 0 is today and -1 is yesterday and so on.
Bi-directional infinite scrolling will add more complexity because views can be pushed onto the front of the virtual list. This means the view needs to be inserted and the scroll position needs to be adjusted in the same frame. I've implemented a prototype inspired by this Apple developer video.
In order to insert the view and adjust the scroll position in the same frame I had to come up with the concept of a synchronous scroll-view. This allows me to do the insert magic at the expense of moving scrolling to the main thread. This also means I have to implement my own scroll physics, which requires two implementations for both desktop and touch devices.
Also, for such bi-directional lists, the user probably doesn't want to see the scrollbar jumping around. One benefit of manually setting the scroll position is the scrollbar is never visible. A little bit of css magic can hide the scrollbar (e.g. a combination of padding and negative margins) but might require measuring the width of scrollbar for the device or just using a sufficiently large value.
Some 1d collections need bi-directional infinite scrolling. A good example is a calendar that is initialized with today's date but allows the user to view past dates. Allowing negative indexes would be one way to implement this. Where 0 is today and -1 is yesterday and so on.
The text was updated successfully, but these errors were encountered: