Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Add scroll snapping for paging in (#2548)
Browse files Browse the repository at this point in the history
InfiniteScrollList
  • Loading branch information
intergalacticspacehighway authored Nov 22, 2023
1 parent d17f6ed commit 9ae1a05
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function InfiniteScrollListImpl<Item>(
renderItem,
extraData,
onViewableItemsChanged,
pagingEnabled,
viewabilityConfig,
ItemSeparatorComponent,
estimatedItemSize,
Expand Down Expand Up @@ -227,6 +228,7 @@ function InfiniteScrollListImpl<Item>(
flexGrow: 1,
//@ts-ignore
...style,
"scroll-snap-type": pagingEnabled ? "y mandatory" : undefined,
}
: {}
}
Expand Down Expand Up @@ -281,7 +283,12 @@ function InfiniteScrollListImpl<Item>(
key={virtualItem.key}
data-index={index}
ref={rowVirtualizer.measureElement}
style={{ width: "100%", ...transformStyle }}
style={{
width: "100%",
...transformStyle,
// @ts-ignore
"scroll-snap-align": pagingEnabled ? "start" : undefined,
}}
>
{typeof data?.[index] !== "undefined" ? (
<div
Expand Down

0 comments on commit 9ae1a05

Please sign in to comment.