Skip to content

An opinionated toast component for React.

Dont dismiss loading toast (#298)

Emil Kowalski84fbfd7ddd24
diff --git a/src/index.tsx b/src/index.tsx
index 08686ba..116da33 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -138,7 +138,7 @@ const Toast = (props: ToastProps) => {
}, [toast, removeToast, setHeights, offset]);
React.useEffect(() => {
- if ((toast.promise && toastType === 'loading') || toast.duration === Infinity) return;
+ if ((toast.promise && toastType === 'loading') || toast.duration === Infinity || toast.type === 'loading') return;
let timeoutId: NodeJS.Timeout;
let remainingTime = duration;
// Pause the timer on each hover
diff --git a/src/types.ts b/src/types.ts
index f005616..8fca882 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -26,6 +26,7 @@ export interface ToastClassnames {
error?: string;
info?: string;
warning?: string;
+ loading?: string;
default?: string;
}