From 28c2a7e2cb65ec548d900e881566b4d0561c4deb Mon Sep 17 00:00:00 2001 From: Christian Baroni <7061887+christianbaroni@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:02:37 +0000 Subject: [PATCH] Fix remaining max button issues --- .../screens/Swap/components/SwapSlider.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/__swaps__/screens/Swap/components/SwapSlider.tsx b/src/__swaps__/screens/Swap/components/SwapSlider.tsx index a4104bd0ce7..7f04181782e 100644 --- a/src/__swaps__/screens/Swap/components/SwapSlider.tsx +++ b/src/__swaps__/screens/Swap/components/SwapSlider.tsx @@ -406,12 +406,18 @@ export const SwapSlider = ({ onPressWorklet={() => { 'worklet'; SwapInputController.inputMethod.value = 'slider'; - SwapInputController.quoteFetchingInterval.stop(); - sliderXPosition.value = withSpring(width, SPRING_CONFIGS.snappySpringConfig, isFinished => { - if (isFinished) { - runOnJS(onChangeWrapper)(1); - } - }); + const isAlreadyMax = sliderXPosition.value === width; + + if (isAlreadyMax) { + runOnJS(triggerHapticFeedback)('impactMedium'); + } else { + SwapInputController.quoteFetchingInterval.stop(); + sliderXPosition.value = withSpring(width, SPRING_CONFIGS.snappySpringConfig, isFinished => { + if (isFinished) { + runOnJS(onChangeWrapper)(1); + } + }); + } }} ref={maxButtonRef} >