From 80b6500ee79cf1259ce3cf3d4999d0c4543d7cc4 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sat, 3 May 2025 16:33:20 +0330 Subject: [PATCH] fix bug animation --- src/components/Toast.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index 2069aff..fe41eb7 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -23,9 +23,10 @@ const ToastContainer: React.FC = () => { t.id === toast.id ? { ...t, isExiting: true } : t )); + // حذف از DOM بعد از اتمام انیمیشن setTimeout(() => { setToasts((prev) => prev.filter((t) => t.id !== toast.id)); - }, 300); + }, 300); // مدت زمان انیمیشن خروج }, 3000); }; @@ -46,6 +47,11 @@ const ToastContainer: React.FC = () => { ? 'bg-white/70 text-black' : 'bg-white/70 text-black' }`} + style={{ + animationFillMode: 'forwards', + animationDuration: '0.3s', + animationTimingFunction: 'ease-out' + }} > { toast.type === 'success' ? :