From 3fd436360d987a6f1121762beb98651532075686 Mon Sep 17 00:00:00 2001 From: Artem Astakhov Date: Wed, 18 Nov 2020 11:50:08 +0300 Subject: [PATCH] fix callback type check --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4b5cb9d8..c947e373 100644 --- a/src/index.ts +++ b/src/index.ts @@ -183,8 +183,10 @@ function getHandlers( props.onSwiped && props.onSwiped(eventData); const onSwipedDir = `onSwiped${eventData.dir}`; - if (onSwipedDir in props) { - ((props as any)[onSwipedDir] as SwipeCallback)(eventData); + const callback = (props as any)[onSwipedDir]; + + if (typeof callback === "function") { + (callback as SwipeCallback)(eventData); } } else { props.onTap && props.onTap({ event });