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:
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]),
|
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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue