diff --git a/components/Context/StorageProvider.tsx b/components/Context/StorageProvider.tsx index eaf63d8f6..3c7e6ee1f 100644 --- a/components/Context/StorageProvider.tsx +++ b/components/Context/StorageProvider.tsx @@ -457,7 +457,6 @@ export const StorageProvider = ({ children }: { children: React.ReactNode }) => refreshAllWalletTransactions, resetWallets, walletTransactionUpdateStatus, - setWalletTransactionUpdateStatus, handleWalletDeletion, ], ); diff --git a/components/WalletsCarousel.tsx b/components/WalletsCarousel.tsx index c2c712813..0b6ebbe00 100644 --- a/components/WalletsCarousel.tsx +++ b/components/WalletsCarousel.tsx @@ -98,8 +98,12 @@ interface WalletCarouselItemProps { isSelectedWallet?: boolean; customStyle?: ViewStyle; horizontal?: boolean; + isPlaceHolder?: boolean; searchQuery?: string; renderHighlightedText?: (text: string, query: string) => JSX.Element; + animationsEnabled?: boolean; + onPressIn?: () => void; + onPressOut?: () => void; } const iStyles = StyleSheet.create({ @@ -161,21 +165,6 @@ const iStyles = StyleSheet.create({ }, }); -interface WalletCarouselItemProps { - item: TWallet; - onPress: (item: TWallet) => void; - handleLongPress?: () => void; - isSelectedWallet?: boolean; - customStyle?: ViewStyle; - horizontal?: boolean; - isPlaceHolder?: boolean; - searchQuery?: string; - renderHighlightedText?: (text: string, query: string) => JSX.Element; - animationsEnabled?: boolean; - onPressIn?: () => void; - onPressOut?: () => void; -} - export const WalletCarouselItem: React.FC = React.memo( ({ item, @@ -203,7 +192,6 @@ export const WalletCarouselItem: React.FC = React.memo( Animated.spring(scaleValue, { toValue: 0.95, useNativeDriver: true, - friction: 3, tension: 100, }).start(); } @@ -215,7 +203,6 @@ export const WalletCarouselItem: React.FC = React.memo( Animated.spring(scaleValue, { toValue: 1.0, useNativeDriver: true, - friction: 3, tension: 100, }).start(); } @@ -362,6 +349,10 @@ const WalletsCarousel = forwardRef((props renderHighlightedText, isFlatList = true, } = props; + + const { width } = useWindowDimensions(); + const itemWidth = React.useMemo(() => (width * 0.82 > 375 ? 375 : width * 0.82), [width]); + const renderItem = useCallback( ({ item, index }: ListRenderItemInfo) => item ? ( @@ -379,7 +370,6 @@ const WalletsCarousel = forwardRef((props ); const flatListRef = useRef>(null); - useImperativeHandle(ref, (): any => { return { scrollToEnd: (params: { animated?: boolean | null | undefined } | undefined) => flatListRef.current?.scrollToEnd(params), @@ -401,10 +391,8 @@ const WalletsCarousel = forwardRef((props getNativeScrollRef: () => flatListRef.current?.getNativeScrollRef(), }; }, []); - const onScrollToIndexFailed = (error: { averageItemLength: number; index: number }): void => { - console.debug('onScrollToIndexFailed'); - console.debug(error); + console.debug('onScrollToIndexFailed', error); flatListRef.current?.scrollToOffset({ offset: error.averageItemLength * error.index, animated: true }); setTimeout(() => { if (data.length !== 0 && flatListRef.current !== null) { @@ -413,16 +401,16 @@ const WalletsCarousel = forwardRef((props }, 100); }; - const { width } = useWindowDimensions(); const sliderHeight = 195; - const itemWidth = width * 0.82 > 375 ? 375 : width * 0.82; + + const keyExtractor = useCallback((item: TWallet, index: number) => (item?.getID ? item.getID() : index.toString()), []); return isFlatList ? ( index.toString()} + keyExtractor={keyExtractor} showsVerticalScrollIndicator={false} pagingEnabled={horizontal} disableIntervalMomentum={horizontal}