From bcd667068ed0204b5a9cc1affbd6ae1ca6f9d16e Mon Sep 17 00:00:00 2001 From: Minko <49073282+hemengke1997@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:19:49 +0800 Subject: [PATCH] fix: notification from useApp should consume App config (#49339) * feat: notfication use global showProgress, pauseOnHover config * fix: notification not inherit app config --- components/notification/index.tsx | 4 ++-- components/notification/useNotification.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/notification/index.tsx b/components/notification/index.tsx index a4b302719a..3f5cfe6e9b 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -34,10 +34,10 @@ let taskQueue: Task[] = []; let defaultGlobalConfig: GlobalConfigProps = {}; function getGlobalContext() { - const { getContainer, rtl, maxCount, top, bottom } = defaultGlobalConfig; + const { getContainer, rtl, maxCount, top, bottom, showProgress, pauseOnHover } = defaultGlobalConfig; const mergedContainer = getContainer?.() || document.body; - return { getContainer: () => mergedContainer, rtl, maxCount, top, bottom }; + return { getContainer: () => mergedContainer, rtl, maxCount, top, bottom, showProgress, pauseOnHover }; } interface GlobalHolderRef { diff --git a/components/notification/useNotification.tsx b/components/notification/useNotification.tsx index e65e354748..cc24b035bd 100644 --- a/components/notification/useNotification.tsx +++ b/components/notification/useNotification.tsx @@ -65,6 +65,8 @@ const Holder = React.forwardRef((props, ref) => { onAllRemoved, stack, duration, + pauseOnHover = true, + showProgress, } = props; const { getPrefixCls, getPopupContainer, notification, direction } = useContext(ConfigContext); const [, token] = useToken(); @@ -89,9 +91,10 @@ const Holder = React.forwardRef((props, ref) => { closable: true, closeIcon: getCloseIcon(prefixCls), duration: duration ?? DEFAULT_DURATION, - pauseOnHover: true, getContainer: () => staticGetContainer?.() || getPopupContainer?.() || document.body, maxCount, + pauseOnHover, + showProgress, onAllRemoved, renderNotifications, stack: