drawer: add afterVisibleChange

This commit is contained in:
jljsj33 2019-04-22 16:26:31 +08:00 committed by jljsj
parent 252e1dd7e9
commit 773b2fdbd6
4 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,8 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
| zIndex | The `z-index` of the Drawer. | Number | 1000 |
| placement | The placement of the Drawer. | 'top' \| 'right' \| 'bottom' \| 'left' | 'right' |
| onClose | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - |
| onVisibleChange | Switch drawer callback. | function(visible) | 无 |
| afterVisibleChange | Callback after the animation ends when switching drawers. | function(visible) | 无 |
<style>
#_hj_feedback_container {

View File

@ -36,6 +36,8 @@ export interface DrawerProps {
push?: boolean;
placement?: placementType;
onClose?: (e: EventType) => void;
onVisibleChange?: (visible: boolean) => void;
afterVisibleChange?: (visible: boolean) => void;
className?: string;
handler?: React.ReactNode;
}
@ -65,6 +67,8 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
prefixCls: PropTypes.string,
placement: PropTypes.oneOf(PlacementTypes),
onClose: PropTypes.func,
onVisibleChange: PropTypes.func,
afterVisibleChange: PropTypes.func,
className: PropTypes.string,
};
@ -231,6 +235,7 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
wrapClassName,
width,
height,
onVisibleChange,
...rest
} = this.props;
warning(
@ -252,6 +257,7 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
handler={false}
{...rest}
{...offsetStyle}
onChange={onVisibleChange}
prefixCls={prefixCls}
open={this.props.visible}
onMaskClick={this.onMaskClick}

View File

@ -34,6 +34,8 @@ title: Drawer
| zIndex | 设置 Drawer 的 `z-index` | Number | 1000 |
| placement | 抽屉的方向 | 'top' \| 'right' \| 'bottom' \| 'left' | 'right'
| onClose | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 |
| onVisibleChange | 切换抽屉的回调 | function(visible) | 无 |
| afterVisibleChange | 切换抽屉时动画结束后的回调 | function(visible) | 无 |
<style>
#_hj_feedback_container {

View File

@ -66,7 +66,7 @@
"rc-checkbox": "~2.1.5",
"rc-collapse": "~1.11.1",
"rc-dialog": "~7.3.0",
"rc-drawer": "~1.7.6",
"rc-drawer": "~1.8.0",
"rc-dropdown": "~2.4.1",
"rc-editor-mention": "^1.1.7",
"rc-form": "^2.4.0",