Skip to content

Commit

Permalink
fix: πŸ› call key{up/donw} callbacks in useKeyPressEvent correct
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 31, 2019
1 parent 0eebe37 commit 60064a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__stories__/useKeyPressEvent.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Demo = () => {
};
const reset = () => setCount(() => 0);

useKeyPressEvent(']', increment, increment);
useKeyPressEvent(']', increment);
useKeyPressEvent('[', decrement, decrement);
useKeyPressEvent('r', reset);

Expand Down
2 changes: 1 addition & 1 deletion src/useKeyPressEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const useKeyPressEvent = (
const [pressed, event] = useKeyPress(key);
useUpdateEffect(() => {
if (!pressed && keyup) keyup(event!);
else if (keydown) keydown(event!);
else if (pressed && keydown) keydown(event!);
}, [pressed]);
};

Expand Down

0 comments on commit 60064a6

Please sign in to comment.