Closed Karakatiza666 closed 3 weeks ago
It was not exposed because it's not related to virtualization and accessing scrollTop/scrollLeft excessively can degrade perf.
If you want scrollLeft while vertical scrolling, use Virtualizer
, like:
<div style="overflow: auto; width:XXpx; height:XXpx" onscroll={(e)=>{ e.target.scrollLeft /* access scrollLeft*/ }}>
<Virtualzer>
...
</Virtualizer>
</div>
I''ll try Virtualizer, thanks! My main goal is to run some code on vertical scroll, but not horizontal scroll
@inokawa still, it is confusing that when you use vertical VList and do a horizontal scroll onscroll
still gets called with scrollTop
value, so you cannot differentiate between vertical and horizontal scrolls
Thanks for the feedback. I updated the docs a bit.
When using VList for a vertical list, when doing horizontal scroll onscroll callback is fired with effectively
scrollTop
value. Ideally, eitheronscroll
callback would provide{scrollLeft: number, scrollTop: number, deltaX: number, deltaY: number}
, oronscrollx
andonscrolly
callbacks that each have(offset: number, delta: number)