Skip to content

An opinionated toast component for React.

check if date exists (#129)

Emil Kowalski0469f680318e
diff --git a/src/index.tsx b/src/index.tsx
index 894749d..de6349d 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -250,7 +250,7 @@ const Toast = (props: ToastProps) => {
pointerStartRef.current = null;
const swipeAmount = Number(toastRef.current?.style.getPropertyValue('--swipe-amount').replace('px', '') || 0);
- const timeTaken = new Date().getTime() - dragStartTime.current.getTime();
+ const timeTaken = new Date().getTime() - dragStartTime.current?.getTime();
const velocity = Math.abs(swipeAmount) / timeTaken;
// Remove only if threshold is met