Skip to content

Commit d6b4d05

Browse files
iRoachiealvaromb
authored andcommitted
Added typescript definitions (#118)
* Added typescript definitions * Typings: Extend from ScrollViewProperties, ListViewProperties
1 parent 53ceaef commit d6b4d05

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

index.d.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Type definitions for react-native-keyboard-aware-scroll-view
2+
// Project: https://github.com/APSL/react-native-keyboard-aware-scroll-view
3+
// Definitions by: Kyle Roach <https://github.com/iRoachie>
4+
// TypeScript Version: 2.3.2
5+
6+
import React from 'react'
7+
import { ScrollViewProperties, ListViewProperties } from 'react-native'
8+
9+
interface KeyboardAwareProps {
10+
/**
11+
* Adds an extra offset that represents the TabBarIOS height.
12+
*
13+
* @type {boolean}
14+
* @memberof KeyboardAwareProps
15+
*/
16+
viewIsInsideTabBar?: boolean
17+
18+
/**
19+
* Coordinates that will be used to reset the scroll when the keyboard hides.
20+
*
21+
* @type {{
22+
* x: number,
23+
* y: number
24+
* }}
25+
* @memberof KeyboardAwareProps
26+
*/
27+
resetScrollToCoords?: {
28+
x: number,
29+
y: number
30+
}
31+
32+
/**
33+
* Lets the user enable or disable automatic resetScrollToCoords
34+
*
35+
* @type {boolean}
36+
* @memberof KeyboardAwareProps
37+
*/
38+
enableResetScrollToCoords?: boolean
39+
40+
/**
41+
* When focus in TextInput will scroll the position
42+
*
43+
* Default is true
44+
*
45+
* @type {boolean}
46+
* @memberof KeyboardAwareProps
47+
*/
48+
enableAutoAutomaticScroll?: boolean
49+
50+
/**
51+
* Adds an extra offset when focusing the TextInputs.
52+
*
53+
* Default is 75
54+
* @type {number}
55+
* @memberof KeyboardAwareProps
56+
*/
57+
extraHeight?: number
58+
59+
/**
60+
* Adds an extra offset to the keyboard.
61+
* Useful if you want to stick elements above the keyboard.
62+
*
63+
* Default is 0
64+
*
65+
* @type {number}
66+
* @memberof KeyboardAwareProps
67+
*/
68+
extraScrollHeight?: number
69+
}
70+
71+
interface KeyboardAwareListViewProps extends KeyboardAwareProps, ListViewProperties {}
72+
interface KeyboardAwareScrollViewProps extends KeyboardAwareProps, ScrollViewProperties {}
73+
74+
export class KeyboardAwareMixin {}
75+
export class KeyboardAwareListView extends React.Component<KeyboardAwareListViewProps, null> { }
76+
export class KeyboardAwareScrollView extends React.Component<KeyboardAwareScrollViewProps, null> { }

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.2.8",
44
"description": "A React Native ScrollView component that resizes when the keyboard appears.",
55
"main": "index.js",
6+
"types": "index.d.ts",
67
"scripts": {
78
"lint": "eslint lib",
89
"test": "npm run lint",

0 commit comments

Comments
 (0)