diff --git a/components/modal/useModal/HookModal.tsx b/components/modal/useModal/HookModal.tsx index ecbeee322dd6..66a71e3ae2cd 100644 --- a/components/modal/useModal/HookModal.tsx +++ b/components/modal/useModal/HookModal.tsx @@ -44,6 +44,8 @@ const HookModal: React.ForwardRefRenderFunction = }, })); + const mergedOkCancel = innerConfig.okCancel ?? innerConfig.type === 'confirm'; + return ( {(contextLocale) => ( @@ -55,8 +57,7 @@ const HookModal: React.ForwardRefRenderFunction = open={open} afterClose={afterClose} okText={ - innerConfig.okText || - (innerConfig.okCancel ? contextLocale.okText : contextLocale.justOkText) + innerConfig.okText || (mergedOkCancel ? contextLocale.okText : contextLocale.justOkText) } direction={direction} cancelText={innerConfig.cancelText || contextLocale.cancelText}