From e0eb0170c23a16cee2f07f58f06c53b060a0f7ba Mon Sep 17 00:00:00 2001 From: Javier Bueno Date: Mon, 16 Oct 2023 18:48:48 +0200 Subject: [PATCH] refactor(swap): refresh animation improvement --- .../src/components/Icon/Refresh.tsx | 36 +++++++++++++------ .../ShowTokenActions/TopTokenActions.tsx | 11 ++++-- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/apps/wallet-mobile/src/components/Icon/Refresh.tsx b/apps/wallet-mobile/src/components/Icon/Refresh.tsx index 0aa3b6f0ed..95854b1d3a 100644 --- a/apps/wallet-mobile/src/components/Icon/Refresh.tsx +++ b/apps/wallet-mobile/src/components/Icon/Refresh.tsx @@ -1,21 +1,35 @@ import React from 'react' -import Svg, {Path} from 'react-native-svg' +import Svg, {ClipPath, Defs, G, Path, Rect} from 'react-native-svg' type Props = { size?: number color?: string + active?: boolean } -export const Refresh = ({size = 24, color = '#242838'}: Props) => ( - - +export const Refresh = ({size = 24, color = '#242838', active = false}: Props) => ( + + + - + + + + + + + + ) diff --git a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx index 5f11f0207a..32c2a0a664 100644 --- a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx +++ b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/ShowTokenActions/TopTokenActions.tsx @@ -61,6 +61,7 @@ export const TopTokenActions = () => { const RefreshIcon = ({onPress, disabled}: {onPress: () => void; disabled: boolean}) => { const spin = React.useRef(new Animated.Value(0)).current + const [isActive, setIsActive] = React.useState(false) const handleOnPress = () => { Animated.timing(spin, { @@ -82,9 +83,15 @@ const RefreshIcon = ({onPress, disabled}: {onPress: () => void; disabled: boolea } return ( - + setIsActive(true)} + onPressOut={() => setIsActive(false)} + > - + )