Skip to content

An opinionated toast component for React.

Fix toast follow pointer on pointer up (#80)

João Pedro Magalhães7d8a895ae3ef
diff --git a/src/index.tsx b/src/index.tsx
index 3711ca9..4dfc4b0 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -290,6 +290,8 @@ const Toast = (props: ToastProps) => {
}}
onPointerUp={() => {
if (swipeOut) return;
+
+ pointerStartRef.current = null;
const swipeAmount = Number(toastRef.current?.style.getPropertyValue('--swipe-amount').replace('px', '') || 0);
// Remove only if treshold is met
@@ -302,7 +304,6 @@ const Toast = (props: ToastProps) => {
}
toastRef.current?.style.setProperty('--swipe-amount', '0px');
- pointerStartRef.current = null;
setSwiping(false);
}}
onPointerMove={(event) => {