mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
fix: allow string list in useKeyboardJs hook
This commit is contained in:
commit
aecbd0bb70
@ -37,5 +37,5 @@ yarn add keyboardjs
|
||||
## Reference
|
||||
|
||||
```js
|
||||
useKeyboardJs(combination: string): [isPressed: boolean, event?: KeyboardEvent]
|
||||
useKeyboardJs(combination: string | string[]): [isPressed: boolean, event?: KeyboardEvent]
|
||||
```
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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<any>(null);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user