From 9cd30deb0564618ab5a2fdc5dde572ef49897000 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Mon, 22 Jul 2024 23:48:29 -0400 Subject: [PATCH] Update WalletsCarousel.tsx --- components/WalletsCarousel.tsx | 46 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/components/WalletsCarousel.tsx b/components/WalletsCarousel.tsx index 7afd61456..8793271f4 100644 --- a/components/WalletsCarousel.tsx +++ b/components/WalletsCarousel.tsx @@ -334,27 +334,31 @@ const WalletsCarousel = forwardRef((props const flatListRef = useRef>(null); - useImperativeHandle(ref, (): any => { - return { - scrollToEnd: (params: { animated?: boolean | null | undefined } | undefined) => flatListRef.current?.scrollToEnd(params), - scrollToIndex: (params: { - animated?: boolean | null | undefined; - index: number; - viewOffset?: number | undefined; - viewPosition?: number | undefined; - }) => flatListRef.current?.scrollToIndex(params), - scrollToItem: (params: { - animated?: boolean | null | undefined; - item: any; - viewOffset?: number | undefined; - viewPosition?: number | undefined; - }) => flatListRef.current?.scrollToItem(params), - scrollToOffset: (params: { animated?: boolean | null | undefined; offset: number }) => flatListRef.current?.scrollToOffset(params), - recordInteraction: () => flatListRef.current?.recordInteraction(), - flashScrollIndicators: () => flatListRef.current?.flashScrollIndicators(), - getNativeScrollRef: () => flatListRef.current?.getNativeScrollRef(), - }; - }, []); + useImperativeHandle( + ref, + (): any => { + return { + scrollToEnd: (params: { animated?: boolean | null | undefined } | undefined) => flatListRef.current?.scrollToEnd(params), + scrollToIndex: (params: { + animated?: boolean | null | undefined; + index: number; + viewOffset?: number | undefined; + viewPosition?: number | undefined; + }) => flatListRef.current?.scrollToIndex(params), + scrollToItem: (params: { + animated?: boolean | null | undefined; + item: any; + viewOffset?: number | undefined; + viewPosition?: number | undefined; + }) => flatListRef.current?.scrollToItem(params), + scrollToOffset: (params: { animated?: boolean | null | undefined; offset: number }) => flatListRef.current?.scrollToOffset(params), + recordInteraction: () => flatListRef.current?.recordInteraction(), + flashScrollIndicators: () => flatListRef.current?.flashScrollIndicators(), + getNativeScrollRef: () => flatListRef.current?.getNativeScrollRef(), + }; + }, + [], + ); const onScrollToIndexFailed = (error: { averageItemLength: number; index: number }): void => { console.log('onScrollToIndexFailed');