Skip to content

Commit

Permalink
Fix remaining max button issues
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbaroni committed Jun 11, 2024
1 parent bc29f01 commit 28c2a7e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/__swaps__/screens/Swap/components/SwapSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
>
Expand Down

0 comments on commit 28c2a7e

Please sign in to comment.