Fix #56 - add acceptedByScrolling to onAccept

Checking the {acceptedByScrolling} boolean property will allow you to
determine whether the acceptance was triggered by the user scrolling
(if acceptedByScrolling=true) or explicitly clicking the Accept button
(if acceptedByScrolling=false).
This commit is contained in:
Matt Knight
2019-12-19 15:39:17 -07:00
parent 9980d42af6
commit 7cc1fc3905
5 changed files with 139 additions and 122 deletions

2
build/index.d.ts vendored
View File

@@ -10,7 +10,7 @@ export interface CookieConsentProps {
children?: React.ReactNode;
disableStyles?: boolean;
hideOnAccept?: boolean;
onAccept?: Function;
onAccept?: ({ acceptedByScrolling }: { acceptedByScrolling?: boolean }) => void;
onDecline?: Function;
buttonText?: Function | React.ReactNode;
declineButtonText?: Function | React.ReactNode;