Skip to content

Commit

Permalink
fix: improve handleCloseToast function in Toast component
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Jul 23, 2024
1 parent 2bc42f2 commit 975b6f3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions library/src/components/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ const Toast = (props: ToastComponentProps) => {

const handleCloseToast = () => {
setIsExiting(true);
setTimeout(() => {
if (props.onClose) {
props.onClose();
}
}, 300);
const animationDisabled = prefersReducedMotion();
if (!animationDisabled) {
setTimeout(() => {
if (props.onClose) {
props.onClose();
}
}, 300);
} else if (props.onClose) {
props.onClose();
}
};

const handleMouseLeave = () => {
Expand Down

0 comments on commit 975b6f3

Please sign in to comment.