1
0
Fork 0
mirror of https://github.com/Alamantus/Lexiconga.git synced 2025-05-02 16:23:19 +02:00

Add onShow and onHide to Modal

This commit is contained in:
Robbie Antenesse 2018-03-09 16:26:10 -07:00
parent fa9422e048
commit 73ef56c97b

View file

@ -13,6 +13,8 @@ export class Modal extends Component {
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
footerAlign: PropTypes.string, footerAlign: PropTypes.string,
footerContent: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), footerContent: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
onShow: PropTypes.func,
onHide: PropTypes.func,
}, props, 'prop', 'Modal'); }, props, 'prop', 'Modal');
this.state = { this.state = {
@ -23,12 +25,20 @@ export class Modal extends Component {
show () { show () {
this.setState({ this.setState({
isVisible: true, isVisible: true,
}, () => {
if (this.props.onShow) {
this.props.onShow();
}
}); });
} }
hide () { hide () {
this.setState({ this.setState({
isVisible: false, isVisible: false,
}, () => {
if (this.props.onHide) {
this.props.onHide();
}
}); });
} }