removed the event listener on will unmount instead of adding it again. (#25844)

This commit is contained in:
Marcus Andersson 2020-06-25 17:04:43 +02:00 committed by GitHub
parent 8f66f5b1ca
commit 7f587b209f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ export class ClickOutsideWrapper extends PureComponent<Props, State> {
componentWillUnmount() {
window.removeEventListener('click', this.onOutsideClick, false);
if (this.props.includeButtonPress) {
window.addEventListener('keyup', this.onOutsideClick, false);
window.removeEventListener('keyup', this.onOutsideClick, false);
}
}