From 73ef56c97b3243d52964c04e929dc99977ee4c54 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 9 Mar 2018 16:26:10 -0700 Subject: [PATCH] Add onShow and onHide to Modal --- src/components/structure/Modal.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/structure/Modal.jsx b/src/components/structure/Modal.jsx index e8f99fb..2acf886 100644 --- a/src/components/structure/Modal.jsx +++ b/src/components/structure/Modal.jsx @@ -13,6 +13,8 @@ export class Modal extends Component { children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), footerAlign: PropTypes.string, footerContent: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), + onShow: PropTypes.func, + onHide: PropTypes.func, }, props, 'prop', 'Modal'); this.state = { @@ -23,12 +25,20 @@ export class Modal extends Component { show () { this.setState({ isVisible: true, + }, () => { + if (this.props.onShow) { + this.props.onShow(); + } }); } hide () { this.setState({ isVisible: false, + }, () => { + if (this.props.onHide) { + this.props.onHide(); + } }); }