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/WindowVirtualizer.tsx b/src/vue/WindowVirtualizer.tsx index 11f4e91f..201923a0 100644 --- a/src/vue/WindowVirtualizer.tsx +++ b/src/vue/WindowVirtualizer.tsx @@ -105,7 +105,8 @@ export const WindowVirtualizer = /*#__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, @@ -215,9 +216,8 @@ export const WindowVirtualizer = /*#__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. */