Last active
August 22, 2016 11:59
-
-
Save BartKrol/551540b951a8ada3cad5ade0154db1ca to your computer and use it in GitHub Desktop.
Popover timeout clearing
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
componentWillReceiveProps(nextProps) { | |
if (nextProps.open !== this.state.open) { | |
// (...) | |
} else { | |
if (nextProps.animated) { | |
if (this.timeout !== null) return; // Return if still closing | |
this.setState({closing: true}); | |
// (...) | |
componentWillUnmount() { | |
clearTimeout(this.timeout); | |
this.timeout = null; // Clear timeout attribute | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment