Skip to content

Commit 0105d0a

Browse files
committed
made onClose callback optional
1 parent c739e46 commit 0105d0a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/simple-modal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export default class Modal extends React.Component{
1111

1212
let opacity = 0,
1313
display = 'block',
14-
visibility = 'hidden';
14+
visibility = 'hidden'
1515

1616
if(props.show){
17-
opacity = 1;
18-
display = 'block';
17+
opacity = 1
18+
display = 'block'
1919
visibility = 'visible'
2020
}
2121

@@ -24,13 +24,13 @@ export default class Modal extends React.Component{
2424
display,
2525
visibility,
2626
show: props.show
27-
};
27+
}
2828

2929
}
3030

3131
hideOnOuterClick(event){
3232
if(this.props.closeOnOuterClick === false) return
33-
if(event.target.dataset.modal) this.props.onClose(event)
33+
if(event.target.dataset.modal && this.props.onClose instanceof Function) this.props.onClose(event)
3434
}
3535

3636
componentWillReceiveProps(props){

0 commit comments

Comments
 (0)