Skip to content

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SpencerWhitehead7 committed Oct 29, 2024
1 parent ee1d42a commit 2911fcd
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/virtual/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ type VirtualListReturn<T extends readonly any[]> = [
viewerTop: number;
visibleItems: T;
}>,
onScroll: (
e: Event & {
target: DOMElement;
},
) => void,
onScroll: (e: Event) => void,
];

/**
Expand Down Expand Up @@ -61,7 +57,8 @@ export function createVirtualList<T extends readonly any[]>({
visibleItems: items.slice(getFirstIdx(), getLastIdx()) as unknown as T,
}),
e => {
setOffset(e.target.scrollTop);
// @ts-expect-error
setOffset(e.target?.scrollTop);
},
];
}
Expand Down Expand Up @@ -90,10 +87,10 @@ export function VirtualList<T extends readonly any[], U extends JSX.Element>(
props: VirtualListProps<T, U>,
): JSX.Element {
const [virtual, onScroll] = createVirtualList({
items: props.each,
rootHeight: props.rootHeight,
rowHeight: props.rowHeight,
overscanCount: props.overscanCount,
items: () => props.each,
rootHeight: () => props.rootHeight,
rowHeight: () => props.rowHeight,
overscanCount: () => props.overscanCount || 1,
});

return (
Expand Down

0 comments on commit 2911fcd

Please sign in to comment.