From ad6fb2d8525ceb722401fa03dc2a886a446ddc0d Mon Sep 17 00:00:00 2001 From: Nishan Date: Tue, 21 Nov 2023 21:33:48 +0530 Subject: [PATCH] Add scroll snapping for paging in InfiniteScrollList --- .../infinite-scroll-list/infinite-scroll-list.web.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/design-system/infinite-scroll-list/infinite-scroll-list.web.tsx b/packages/design-system/infinite-scroll-list/infinite-scroll-list.web.tsx index 783e97f11f..286253a46d 100644 --- a/packages/design-system/infinite-scroll-list/infinite-scroll-list.web.tsx +++ b/packages/design-system/infinite-scroll-list/infinite-scroll-list.web.tsx @@ -44,6 +44,7 @@ function InfiniteScrollListImpl( renderItem, extraData, onViewableItemsChanged, + pagingEnabled, viewabilityConfig, ItemSeparatorComponent, estimatedItemSize, @@ -227,6 +228,7 @@ function InfiniteScrollListImpl( flexGrow: 1, //@ts-ignore ...style, + "scroll-snap-type": pagingEnabled ? "y mandatory" : undefined, } : {} } @@ -281,7 +283,12 @@ function InfiniteScrollListImpl( 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" ? (