From 8c820ce063b7a0218528dcbb76faa896101f6976 Mon Sep 17 00:00:00 2001 From: dabuside Date: Fri, 2 Aug 2019 12:19:20 +0800 Subject: [PATCH 1/2] fix(useKeyboardJs): fix argument type error --- docs/useKeyboardJs.md | 2 +- src/useKeyboardJs.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/useKeyboardJs.md b/docs/useKeyboardJs.md index 6dc09ef914..3df9d49d1b 100644 --- a/docs/useKeyboardJs.md +++ b/docs/useKeyboardJs.md @@ -37,5 +37,5 @@ yarn add keyboardjs ## Reference ```js -useKeyboardJs(combination: string): [isPressed: boolean, event?: KeyboardEvent] +useKeyboardJs(combination: string | string[]): [isPressed: boolean, event?: KeyboardEvent] ``` diff --git a/src/useKeyboardJs.ts b/src/useKeyboardJs.ts index c67d9f2fb2..3ae5cc4614 100644 --- a/src/useKeyboardJs.ts +++ b/src/useKeyboardJs.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import useMount from './useMount'; -const useKeyboardJs = (combination: string) => { +const useKeyboardJs = (combination: string | string[]) => { const [state, set] = useState<[boolean, null | KeyboardEvent]>([false, null]); const [keyboardJs, setKeyboardJs] = useState(null); From b7481f6cd5160cd0af5fe9ae9ad551b08137489b Mon Sep 17 00:00:00 2001 From: dabuside Date: Fri, 2 Aug 2019 13:45:47 +0800 Subject: [PATCH 2/2] fix(storybook): fix useKeyboardJs import path --- src/__stories__/useKeyboardJs.story.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__stories__/useKeyboardJs.story.tsx b/src/__stories__/useKeyboardJs.story.tsx index f9e83e9b30..fd2f16cd86 100644 --- a/src/__stories__/useKeyboardJs.story.tsx +++ b/src/__stories__/useKeyboardJs.story.tsx @@ -1,7 +1,7 @@ import { text, withKnobs } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; import * as React from 'react'; -import { useKeyboardJs } from '..'; +import useKeyboardJs from '../useKeyboardJs'; import { CenterStory } from './util/CenterStory'; import ShowDocs from './util/ShowDocs';