Skip to content

Commit

Permalink
fix: add typescript typings (#21)
Browse files Browse the repository at this point in the history
This adds support for typescript
  • Loading branch information
Hanno J. Gödecke committed Nov 18, 2021
1 parent e73a63c commit 7d096fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export interface UseKeyboardOptions {
/**
* @default false
*/
useWillShow?: boolean
/**
* @default false
*/
useWillHide?: boolean
}

/**
* Hook that listens to keyboard events and tell whether the keyboard is currently
* visible or not.
* Returns [isVisible, a dismiss function]
*/
declare const useKeyboard: (options?: UseKeyboardOptions) => [boolean, () => void];
export default useKeyboard;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/react-native-hooks-keyboard.cjs.js",
"jsnext:main": "dist/react-native-hooks-keyboard.esm.js",
"module": "dist/react-native-hooks-keyboard.esm.js",
"types": "index.d.ts",
"scripts": {
"prebuild": "rimraf dist",
"prepublishOnly": "run-s build",
Expand All @@ -19,7 +20,8 @@
"yalc": "npm run build && yalc push"
},
"files": [
"dist"
"dist",
"index.d.ts"
],
"keywords": [
"react-native",
Expand Down

0 comments on commit 7d096fb

Please sign in to comment.