Skip to content

Instantly share code, notes, and snippets.

@orb
Last active April 6, 2017 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orb/c584a569964099221723810abbff2c66 to your computer and use it in GitHub Desktop.
Save orb/c584a569964099221723810abbff2c66 to your computer and use it in GitHub Desktop.
bootrap modal hide event
// 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