Skip to content

Commit

Permalink
fix: Adding missing useEventCallback (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Apr 24, 2020
1 parent 7c3ab82 commit cb7e2ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof listen> | null>();
const removeKeydownListenerRef = useRef<ReturnType<typeof listen> | null>();
Expand Down

0 comments on commit cb7e2ab

Please sign in to comment.