minhtranite / react-modal-bootstrap

Modal component for React with bootstrap style.
https://www.npmjs.com/package/react-modal-bootstrap
36 stars 15 forks source link

Able to reopen modal if background is clicked during closing animation #19

Open darrenklein opened 6 years ago

darrenklein commented 6 years ago

Hello - thanks for your hard work on this module.

I've found that, if I click the modal-backdrop during the modal's closing animation (during the 0.4 second transition), the modal will reopen, albeit with no content - just an empty modal.

I've worked out a solution and would like to open a pull request, with your permission. For everyone's benefit, I'll post the fix here:

Change line 81 of lib/Modal.js to read

if (e.target !== e.currentTarget || !backdrop || !_this.props.isOpen) {

and change line 62 of src/Modal.js to read

if (e.target !== e.currentTarget || !backdrop || !this.props.isOpen) {

Or just fork the master branch of my fork of this project (which includes Radium 16 fixes) from https://github.com/darrenklein/react-modal-bootstrap