mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
fix #11307 Prop destroyOnClose prevents the closing animation of drawer
This commit is contained in:
parent
a2c4b03d45
commit
e7242f4924
@ -46,7 +46,11 @@ exports[`Drawer destroyOnClose is true 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-drawer-content"
|
||||
/>
|
||||
>
|
||||
<div
|
||||
style="overflow: auto; height: 100%; width: 256px;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -108,8 +108,16 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
||||
}
|
||||
renderBody = () => {
|
||||
const { destroyOnClose, visible, width, placement } = this.props;
|
||||
let containerStyle: React.CSSProperties = { width };
|
||||
if (placement === 'left' || placement === 'right') {
|
||||
containerStyle = {
|
||||
overflow: 'auto',
|
||||
height: '100%',
|
||||
width,
|
||||
};
|
||||
}
|
||||
if (destroyOnClose && !visible) {
|
||||
return null;
|
||||
return <div style={containerStyle}/>;
|
||||
}
|
||||
const { prefixCls, title, closable } = this.props;
|
||||
let header;
|
||||
@ -132,14 +140,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
||||
</button>
|
||||
);
|
||||
}
|
||||
let containerStyle: React.CSSProperties = { width };
|
||||
if (placement === 'left' || placement === 'right') {
|
||||
containerStyle = {
|
||||
overflow: 'auto',
|
||||
height: '100%',
|
||||
width,
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={containerStyle}>
|
||||
{header}
|
||||
@ -172,6 +173,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
||||
showMask={this.props.mask}
|
||||
placement={placement}
|
||||
style={RcDrawerStyle}
|
||||
class={this.props.wrapClassName}
|
||||
>
|
||||
{this.renderBody()}
|
||||
</RcDrawer>
|
||||
|
@ -59,7 +59,7 @@
|
||||
"rc-checkbox": "~2.1.5",
|
||||
"rc-collapse": "~1.9.0",
|
||||
"rc-dialog": "~7.1.0",
|
||||
"rc-drawer": "~1.5.3",
|
||||
"rc-drawer": "~1.5.7",
|
||||
"rc-dropdown": "~2.2.0",
|
||||
"rc-editor-mention": "^1.0.2",
|
||||
"rc-form": "^2.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user