From f01e2399474fd52e67b51c6c6a0c362e099b3bbc Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 3 Jan 2022 17:54:26 +0100 Subject: [PATCH] refactor(useKeyPress): check if key code is string --- example/src/Interaction/index.tsx | 2 -- src/hooks/useKeyPress.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/example/src/Interaction/index.tsx b/example/src/Interaction/index.tsx index 0daf76fb..6862b280 100644 --- a/example/src/Interaction/index.tsx +++ b/example/src/Interaction/index.tsx @@ -51,8 +51,6 @@ const InteractionFlow = () => { const [captureZoomScroll, setCaptureZoomScroll] = useState(false); const [captureElementClick, setCaptureElementClick] = useState(false); - console.log(11, captureElementClick); - return ( , Keys]>(() => { if (keyCode !== null) { const keyCodeArr = Array.isArray(keyCode) ? keyCode : [keyCode]; - const keys = keyCodeArr.map((kc) => kc.split('+')); + const keys = keyCodeArr.filter((kc) => typeof kc === 'string').map((kc) => kc.split('+')); const keysFlat = keys.reduce((res: Keys, item) => res.concat(...item), []); return [keys, keysFlat];