Add scroll events to grid

This commit is contained in:
jeffvli
2022-11-20 01:52:34 -08:00
parent cf9187f548
commit b51a79c3cd
2 changed files with 8 additions and 0 deletions
@@ -22,8 +22,10 @@ export const VirtualGridWrapper = ({
itemCount, itemCount,
columnCount, columnCount,
rowCount, rowCount,
initialScrollOffset,
itemData, itemData,
route, route,
onScroll,
...rest ...rest
}: Omit<FixedSizeListProps, 'ref' | 'itemSize' | 'children'> & { }: Omit<FixedSizeListProps, 'ref' | 'itemSize' | 'children'> & {
cardRows: CardRow[]; cardRows: CardRow[];
@@ -75,10 +77,12 @@ export const VirtualGridWrapper = ({
ref={refInstance} ref={refInstance}
{...rest} {...rest}
useIsScrolling useIsScrolling
initialScrollOffset={initialScrollOffset}
itemCount={rowCount} itemCount={rowCount}
itemData={{ ...memo, handlePlayQueueAdd }} itemData={{ ...memo, handlePlayQueueAdd }}
itemSize={itemHeight} itemSize={itemHeight}
overscanCount={5} overscanCount={5}
onScroll={onScroll}
> >
{GridCard} {GridCard}
</FixedSizeList> </FixedSizeList>
@@ -34,9 +34,11 @@ export const VirtualInfiniteGrid = ({
itemType, itemType,
cardRows, cardRows,
route, route,
onScroll,
display, display,
minimumBatchSize, minimumBatchSize,
fetchFn, fetchFn,
initialScrollOffset,
height, height,
width, width,
refresh, refresh,
@@ -118,6 +120,7 @@ export const VirtualInfiniteGrid = ({
columnCount={columnCount} columnCount={columnCount}
display={display || CardDisplayType.CARD} display={display || CardDisplayType.CARD}
height={height} height={height}
initialScrollOffset={initialScrollOffset}
itemCount={itemCount || 0} itemCount={itemCount || 0}
itemData={itemData} itemData={itemData}
itemGap={itemGap} itemGap={itemGap}
@@ -132,6 +135,7 @@ export const VirtualInfiniteGrid = ({
rowCount={rowCount} rowCount={rowCount}
width={width} width={width}
onItemsRendered={onItemsRendered} onItemsRendered={onItemsRendered}
onScroll={onScroll}
/> />
)} )}
</InfiniteLoader> </InfiniteLoader>