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:
parent
fa9422e048
commit
73ef56c97b
1 changed files with 10 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue