Merge pull request #42 from a-game/fix/acceptOnScroll-forced-in-debug

Fix: Debug mode overriding acceptOnScroll property
This commit is contained in:
Rick van Lieshout 2019-06-27 14:24:53 +02:00 committed by GitHub
commit 68a8301cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,8 +66,8 @@ class CookieConsent extends Component {
this.setState({ visible: true });
}
// if acceptOnScroll is set to true and cookie is undefined or debug is set to true, add a listener.
if ((this.props.acceptOnScroll && Cookies.get(cookieName) === undefined) || debug) {
// if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener.
if (this.props.acceptOnScroll && (Cookies.get(cookieName) === undefined || debug)) {
window.addEventListener("scroll", this.handleScroll, { passive: true });
}
}