From e7242f4924a0b0d9f1f1e63b798c8bbbe06f3504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Wed, 18 Jul 2018 15:52:51 +0800 Subject: [PATCH] fix #11307 Prop destroyOnClose prevents the closing animation of drawer --- .../__snapshots__/Drawer.test.js.snap | 6 +++++- components/drawer/index.tsx | 20 ++++++++++--------- package.json | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index a50ed45ed4..bb8d8d914e 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -46,7 +46,11 @@ exports[`Drawer destroyOnClose is true 1`] = ` >
+ > +
+
diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 85599a834b..798cf9f65c 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -108,8 +108,16 @@ export default class Drawer extends React.Component { } 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
; } const { prefixCls, title, closable } = this.props; let header; @@ -132,14 +140,7 @@ export default class Drawer extends React.Component { ); } - let containerStyle: React.CSSProperties = { width }; - if (placement === 'left' || placement === 'right') { - containerStyle = { - overflow: 'auto', - height: '100%', - width, - }; - } + return (
{header} @@ -172,6 +173,7 @@ export default class Drawer extends React.Component { showMask={this.props.mask} placement={placement} style={RcDrawerStyle} + class={this.props.wrapClassName} > {this.renderBody()} diff --git a/package.json b/package.json index 0371f9080d..f93c2b5188 100644 --- a/package.json +++ b/package.json @@ -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",