Merge pull request #7660 from Tainan404/issue-7655

Handle dismiss prop being undefined.
This commit is contained in:
Anton Georgiev 2019-06-21 13:52:03 -04:00 committed by GitHub
commit f0d96a7571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,7 @@ const defaultProps = {
disabled: false,
},
dismiss: {
callback: () => {},
disabled: false,
},
preventClosing: false,

View File

@ -37,7 +37,12 @@ class ModalSimple extends Component {
}
handleDismiss() {
this.props.modalHide(this.props.dismiss.callback);
const {
modalHide,
dismiss,
} = this.props;
if (!dismiss || !modalHide) return;
modalHide(dismiss.callback);
}
render() {