Skip to content

Commit

Permalink
fix: notification from useApp should consume App config (ant-design#4…
Browse files Browse the repository at this point in the history
…9339)

* feat: notfication use global showProgress, pauseOnHover config

* fix: notification not inherit app config
  • Loading branch information
hemengke1997 authored Jun 11, 2024
1 parent 50a5bf6 commit bcd6670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/notification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion components/notification/useNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ const Holder = React.forwardRef<HolderRef, HolderProps>((props, ref) => {
onAllRemoved,
stack,
duration,
pauseOnHover = true,
showProgress,
} = props;
const { getPrefixCls, getPopupContainer, notification, direction } = useContext(ConfigContext);
const [, token] = useToken();
Expand All @@ -89,9 +91,10 @@ const Holder = React.forwardRef<HolderRef, HolderProps>((props, ref) => {
closable: true,
closeIcon: getCloseIcon(prefixCls),
duration: duration ?? DEFAULT_DURATION,
pauseOnHover: true,
getContainer: () => staticGetContainer?.() || getPopupContainer?.() || document.body,
maxCount,
pauseOnHover,
showProgress,
onAllRemoved,
renderNotifications,
stack:
Expand Down

0 comments on commit bcd6670

Please sign in to comment.