Skip to content

An opinionated toast component for React.

fix swipe to top (#94)

João Pedro Magalhãesfc9a50489939
diff --git a/src/index.tsx b/src/index.tsx
index 0d80758..037b20d 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -269,7 +269,7 @@ const Toast = (props: ToastProps) => {
const clamp = y === 'top' ? Math.min : Math.max;
const clampedY = clamp(0, yPosition);
const swipeStartThreshold = event.pointerType === 'touch' ? 10 : 2;
- const isAllowedToSwipe = clampedY > swipeStartThreshold;
+ const isAllowedToSwipe = Math.abs(clampedY) > swipeStartThreshold;
if (isAllowedToSwipe) {
toastRef.current?.style.setProperty('--swipe-amount', `${yPosition}px`);