fix: Modal.method bodyStyle not working (#32934)

* fix: Modal.method bodyStyle失效

* test: Modal.method bodyStyle失效

* Apply suggestions from code review

Co-authored-by: 晋文涛 <jinwentao@zhaojiafang.com>
Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
benben 2021-11-18 18:29:29 +08:00 committed by GitHub
parent 4ca697611f
commit 30844793a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -95,6 +95,7 @@ const ConfirmDialog = (props: ConfirmDialogProps) => {
maskClosable={maskClosable}
maskStyle={maskStyle}
style={style}
bodyStyle={bodyStyle}
width={width}
zIndex={zIndex}
afterClose={afterClose}
@ -105,9 +106,10 @@ const ConfirmDialog = (props: ConfirmDialogProps) => {
closeIcon={closeIcon}
modalRender={modalRender}
focusTriggerAfterClose={focusTriggerAfterClose}
>
<div className={`${contentPrefixCls}-body-wrapper`}>
<div className={`${contentPrefixCls}-body`} style={bodyStyle}>
<div className={`${contentPrefixCls}-body`}>
{icon}
{props.title === undefined ? null : (
<span className={`${contentPrefixCls}-title`}>{props.title}</span>

View File

@ -545,4 +545,10 @@ describe('Modal.confirm triggers callbacks correctly', () => {
await sleep(500);
expect(afterClose).toHaveBeenCalled();
});
it('bodyStyle', async () => {
open({ bodyStyle: { width: 500 }});
const {width} = $$('.ant-modal-body')[0].style;
expect(width).toBe("500px");
});
});