From 8d1b9cfdb0131e7e4b15cbf993a2876635e9e8a2 Mon Sep 17 00:00:00 2001 From: Chris Naismith Date: Fri, 8 May 2020 13:14:57 -0400 Subject: [PATCH] pass event to onClickAway prop --- src/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 803fe05..561f4fc 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,7 +4,7 @@ type MouseEvents = 'click' | 'mousedown' | 'mouseup'; type TouchEvents = 'touchstart' | 'touchend'; interface Props { - onClickAway: Function; + onClickAway: (event: MouseEvent | TouchEvent) => void; mouseEvent?: MouseEvents; touchEvent?: TouchEvents; } @@ -23,7 +23,7 @@ const ClickAwayListener: FunctionComponent = ({ return; } - onClickAway(); + onClickAway(event); }; document.addEventListener(mouseEvent, handleEvents);