diff --git a/src/react/Virtualizer.tsx b/src/react/Virtualizer.tsx index 4eb16756..287c929f 100644 --- a/src/react/Virtualizer.tsx +++ b/src/react/Virtualizer.tsx @@ -156,9 +156,8 @@ export interface VirtualizerProps { scrollRef?: RefObject; /** * Callback invoked whenever scroll offset changes. - * @param offset Current scrollTop, or scrollLeft if horizontal: true. */ - onScroll?: (offset: number) => void; + onScroll?: () => void; /** * Callback invoked when scrolling stops. */ @@ -268,7 +267,8 @@ export const Virtualizer = forwardRef( } ); const unsubscribeOnScroll = store.$subscribe(UPDATE_SCROLL_EVENT, () => { - onScroll[refKey] && onScroll[refKey](store.$getScrollOffset()); + // https://github.com/inokawa/virtua/discussions/580 + onScroll[refKey] && onScroll[refKey](); }); const unsubscribeOnScrollEnd = store.$subscribe( UPDATE_SCROLL_END_EVENT, diff --git a/src/react/WindowVirtualizer.tsx b/src/react/WindowVirtualizer.tsx index e8222b69..f8e77785 100644 --- a/src/react/WindowVirtualizer.tsx +++ b/src/react/WindowVirtualizer.tsx @@ -107,9 +107,8 @@ export interface WindowVirtualizerProps { item?: keyof JSX.IntrinsicElements | CustomItemComponent; /** * Callback invoked whenever scroll offset changes. - * @param offset Current scrollTop, or scrollLeft if horizontal: true. */ - onScroll?: (offset: number) => void; + onScroll?: () => void; /** * Callback invoked when scrolling stops. */ @@ -198,7 +197,8 @@ export const WindowVirtualizer = forwardRef< } ); const unsubscribeOnScroll = store.$subscribe(UPDATE_SCROLL_EVENT, () => { - onScroll[refKey] && onScroll[refKey](store.$getScrollOffset()); + // https://github.com/inokawa/virtua/discussions/580 + onScroll[refKey] && onScroll[refKey](); }); const unsubscribeOnScrollEnd = store.$subscribe( UPDATE_SCROLL_END_EVENT, diff --git a/src/solid/WindowVirtualizer.tsx b/src/solid/WindowVirtualizer.tsx index 708fccaa..b983da75 100644 --- a/src/solid/WindowVirtualizer.tsx +++ b/src/solid/WindowVirtualizer.tsx @@ -84,9 +84,8 @@ export interface WindowVirtualizerProps { horizontal?: boolean; /** * Callback invoked whenever scroll offset changes. - * @param offset Current scrollTop, or scrollLeft if horizontal: true. */ - onScroll?: (offset: number) => void; + onScroll?: () => void; /** * Callback invoked when scrolling stops. */ @@ -130,7 +129,8 @@ export const WindowVirtualizer = ( }); const unsubscribeOnScroll = store.$subscribe(UPDATE_SCROLL_EVENT, () => { - props.onScroll?.(store.$getScrollOffset()); + // https://github.com/inokawa/virtua/discussions/580 + props.onScroll?.(); }); const unsubscribeOnScrollEnd = store.$subscribe( UPDATE_SCROLL_END_EVENT, diff --git a/src/svelte/WindowVirtualizer.svelte b/src/svelte/WindowVirtualizer.svelte index 6c148a50..05888976 100644 --- a/src/svelte/WindowVirtualizer.svelte +++ b/src/svelte/WindowVirtualizer.svelte @@ -47,7 +47,8 @@ }); const unsubscribeOnScroll = store.$subscribe(UPDATE_SCROLL_EVENT, () => { - onscroll && onscroll(store.$getScrollOffset()); + // https://github.com/inokawa/virtua/discussions/580 + onscroll && onscroll(); }); const unsubscribeOnScrollEnd = store.$subscribe( UPDATE_SCROLL_END_EVENT, diff --git a/src/svelte/WindowVirtualizer.type.ts b/src/svelte/WindowVirtualizer.type.ts index df2bc4fc..93796c44 100644 --- a/src/svelte/WindowVirtualizer.type.ts +++ b/src/svelte/WindowVirtualizer.type.ts @@ -40,9 +40,8 @@ export interface WindowVirtualizerProps { horizontal?: boolean; /** * Callback invoked whenever scroll offset changes. - * @param offset Current scrollTop, or scrollLeft if horizontal: true. */ - onscroll?: (offset: number) => void; + onscroll?: () => void; /** * Callback invoked when scrolling stops. */ diff --git a/src/vue/Virtualizer.tsx b/src/vue/Virtualizer.tsx index 24819a37..ac200c1a 100644 --- a/src/vue/Virtualizer.tsx +++ b/src/vue/Virtualizer.tsx @@ -154,7 +154,8 @@ export const Virtualizer = /*#__PURE__*/ defineComponent({ }); const unsubscribeOnScroll = store.$subscribe(UPDATE_SCROLL_EVENT, () => { - emit("scroll", store.$getScrollOffset()); + // https://github.com/inokawa/virtua/discussions/580 + emit("scroll"); }); const unsubscribeOnScrollEnd = store.$subscribe( UPDATE_SCROLL_END_EVENT, @@ -295,9 +296,8 @@ export const Virtualizer = /*#__PURE__*/ defineComponent({ { /** * Callback invoked whenever scroll offset changes. - * @param offset Current scrollTop, or scrollLeft if horizontal: true. */ - scroll: (offset: number) => void; + scroll: () => void; /** * Callback invoked when scrolling stops. */