Skip to content

Commit

Permalink
fix(Notification): Fix "Timer not started" error for notifications th…
Browse files Browse the repository at this point in the history
…at should not auto close (#1101)

Co-authored-by: Tim Auf dem Kampe <[email protected]>
  • Loading branch information
TimAufdemKampe and Tim Auf dem Kampe authored Jan 15, 2025
1 parent 6725be5 commit f9b5975
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ export const ControlledNotification: FC<Props> = (props) => {

return cloneElement(notification.element, {
onMouseEnter: () => {
notification.meta.autoCloseTimer.pause();
if (notification.element.props.autoClose) {
notification.meta.autoCloseTimer.pause();
}
},
onMouseLeave: () => {
notification.meta.autoCloseTimer.resume();
if (notification.element.props.autoClose) {
notification.meta.autoCloseTimer.resume();
}
},
onClose: () => {
controller.remove(notification.meta.id);
notification.element.props.onClose?.();
},
onFocus: () => {
notification.meta.autoCloseTimer.pause();
if (notification.element.props.autoClose) {
notification.meta.autoCloseTimer.pause();
}
},
onBlur: () => {
notification.meta.autoCloseTimer.resume();
if (notification.element.props.autoClose) {
notification.meta.autoCloseTimer.resume();
}
},
});
};
Expand Down

0 comments on commit f9b5975

Please sign in to comment.