Last active
April 6, 2017 16:14
-
-
Save orb/c584a569964099221723810abbff2c66 to your computer and use it in GitHub Desktop.
bootrap modal hide event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// capturing the hide event instead of the hidden event lets us intercept the close and update our state | |
// | |
componentDidMount = () => { | |
$(this.node).on("hide.bs.modal", | |
(e) => { | |
if (this.props.open) { | |
// if we say the modal should be open but it want's to close | |
e.preventDefault(); // stop it from closing | |
this.props.closeMe(); // update our state to request our close, if we want that behavior | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment