1
0
Fork 0
mirror of https://github.com/Alamantus/Lexiconga.git synced 2025-04-29 23:03:00 +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]),
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();
}
});
}