diff --git a/packages/kit/src/views/Swap/components/SwapRefreshButton.tsx b/packages/kit/src/views/Swap/components/SwapRefreshButton.tsx index ddbaf58e674..2fa228fd61f 100644 --- a/packages/kit/src/views/Swap/components/SwapRefreshButton.tsx +++ b/packages/kit/src/views/Swap/components/SwapRefreshButton.tsx @@ -16,6 +16,7 @@ const SwapRefreshButton = ({ }) => { const loadingAnim = useRef(new Animated.Value(0)).current; const processAnim = useRef(new Animated.Value(0)).current; + const processAnimRef = useRef(); const themeVariant = useThemeVariant(); const lottieRef = useRef(null); const isFocused = useRouteIsFocused(); @@ -52,14 +53,17 @@ const SwapRefreshButton = ({ useEffect(() => { if (!isRefreshQuoteRef.current) { - Animated.timing(processAnim, { + processAnimRef.current = Animated.timing(processAnim, { toValue: swapRefreshInterval, duration: swapRefreshInterval, useNativeDriver: true, - }).start(); + }); + processAnimRef.current?.reset(); + processAnimRef.current?.start(); } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call lottieRef.current?.reset(); + processAnimRef.current?.reset(); } }, [processAnim, isRefreshQuote]); diff --git a/packages/kit/src/views/Swap/hooks/useSwapQuote.ts b/packages/kit/src/views/Swap/hooks/useSwapQuote.ts index 91b949a0591..4ab3fe6cbda 100644 --- a/packages/kit/src/views/Swap/hooks/useSwapQuote.ts +++ b/packages/kit/src/views/Swap/hooks/useSwapQuote.ts @@ -64,6 +64,7 @@ export function useSwapQuote() { const swapShouldRefreshRef = useRef(swapShouldRefresh); const swapQuoteActionLockRef = useRef(swapQuoteActionLock); const swapQuoteFetchingRef = useRef(swapQuoteFetching); + const swapSlippageRef = useRef(slippageItem); if (swapQuoteFetchingRef.current !== swapQuoteFetching) { swapQuoteFetchingRef.current = swapQuoteFetching;