From cb7e2ab299f450ef342fb572cafa355c0108eb26 Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Fri, 24 Apr 2020 16:02:12 -0400 Subject: [PATCH] fix: Adding missing useEventCallback (#804) --- src/Modal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Modal.tsx b/src/Modal.tsx index 8c29f065..0888b7db 100644 --- a/src/Modal.tsx +++ b/src/Modal.tsx @@ -278,12 +278,12 @@ const Modal: React.ForwardRefExoticComponent< } }); - const handleDocumentKeyDown = (e: KeyboardEvent) => { + const handleDocumentKeyDown = useEventCallback((e: KeyboardEvent) => { if (keyboard && e.keyCode === 27 && modal.isTopModal()) { onEscapeKeyDown?.(e); onHide(); } - }; + }); const removeFocusListenerRef = useRef | null>(); const removeKeydownListenerRef = useRef | null>();