Skip to content

Commit 7d096fb

Browse files
author
Hanno J. Gödecke
authored
fix: add typescript typings (#21)
This adds support for typescript
1 parent e73a63c commit 7d096fb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

index.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export interface UseKeyboardOptions {
2+
/**
3+
* @default false
4+
*/
5+
useWillShow?: boolean
6+
/**
7+
* @default false
8+
*/
9+
useWillHide?: boolean
10+
}
11+
12+
/**
13+
* Hook that listens to keyboard events and tell whether the keyboard is currently
14+
* visible or not.
15+
* Returns [isVisible, a dismiss function]
16+
*/
17+
declare const useKeyboard: (options?: UseKeyboardOptions) => [boolean, () => void];
18+
export default useKeyboard;

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "dist/react-native-hooks-keyboard.cjs.js",
66
"jsnext:main": "dist/react-native-hooks-keyboard.esm.js",
77
"module": "dist/react-native-hooks-keyboard.esm.js",
8+
"types": "index.d.ts",
89
"scripts": {
910
"prebuild": "rimraf dist",
1011
"prepublishOnly": "run-s build",
@@ -19,7 +20,8 @@
1920
"yalc": "npm run build && yalc push"
2021
},
2122
"files": [
22-
"dist"
23+
"dist",
24+
"index.d.ts"
2325
],
2426
"keywords": [
2527
"react-native",

0 commit comments

Comments
 (0)