Skip to content

Commit 8708ebc

Browse files
committed
feat: add typescript definitions
Ref: #20 #22
1 parent aded87a commit 8708ebc

File tree

2 files changed

+80
-5
lines changed

2 files changed

+80
-5
lines changed

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.4.0",
44
"description": "React native input with increase and decrease buttons",
55
"main": "./src/index.js",
6+
"types": "./src/index.d.ts",
67
"scripts": {
78
"prettify": "prettier --write './src/*.{ts,json,md,yml,js}'",
89
"test": "echo \"Error: no test specified\" && exit 1"
@@ -27,10 +28,6 @@
2728
"integer",
2829
"decimal"
2930
],
30-
"peerDependencies": {
31-
"react": "*",
32-
"react-native": "*"
33-
},
3431
"publishConfig": {
3532
"registry": "https://registry.npmjs.org/"
3633
},
@@ -41,6 +38,12 @@
4138
},
4239
"homepage": "https://github.com/marcocesarato/react-native-input-spinner#readme",
4340
"license": "GPL-3.0-or-later",
41+
"peerDependencies": {
42+
"@types/react": "*",
43+
"@types/react-native": "*",
44+
"react": "*",
45+
"react-native": "*"
46+
},
4447
"dependencies": {
4548
"prop-types": "^15.7.2"
4649
},
@@ -52,4 +55,4 @@
5255
"env": {},
5356
"packageManager": "npm"
5457
}
55-
}
58+
}

src/index.d.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import {Component} from "react";
2+
import {StyleProp, ViewStyle} from "react-native";
3+
4+
export interface ReactNativeInputSpinnerProps {
5+
type?: string;
6+
min?: string | number;
7+
max?: string | number;
8+
value?: string | number;
9+
step?: string | number;
10+
precision?: number;
11+
rounded?: boolean;
12+
activeOpacity?: number;
13+
color?: string;
14+
colorPress?: string;
15+
colorRight?: string;
16+
colorLeft?: string;
17+
colorMax?: string;
18+
colorMin?: string;
19+
background?: string;
20+
textColor?: string;
21+
arrows?: boolean;
22+
showBorder?: boolean;
23+
fontSize?: number;
24+
fontFamily?: string;
25+
buttonFontSize?: number;
26+
buttonFontFamily?: string;
27+
buttonTextColor?: string;
28+
maxLength?: number;
29+
disabled?: boolean;
30+
editable?: boolean;
31+
autofocus?: boolean;
32+
selectTextOnFocus?: boolean;
33+
placeholder?: string;
34+
placeholderTextColor?: string;
35+
selectionColor?: string;
36+
returnKeyLabel?: string;
37+
returnKeyType?: string;
38+
width?: string | number;
39+
height?: string | number;
40+
onChange?(...args: unknown[]): unknown;
41+
onFocus?(...args: unknown[]): unknown;
42+
onBlur?(...args: unknown[]): unknown;
43+
onKeyPress?(...args: unknown[]): unknown;
44+
onMin?(...args: unknown[]): unknown;
45+
onMax?(...args: unknown[]): unknown;
46+
onIncrease?(...args: unknown[]): unknown;
47+
onDecrease?(...args: unknown[]): unknown;
48+
onSubmit?(...args: unknown[]): unknown;
49+
onLongPressDelay?: number;
50+
onLongPressSpeed?: number;
51+
typingTime?: number;
52+
buttonLeftDisabled?: boolean;
53+
buttonRightDisabled?: boolean;
54+
buttonLeftText?: string;
55+
buttonRightText?: string;
56+
buttonLeftImage?: React.ReactElement;
57+
buttonRightImage?: React.ReactElement;
58+
buttonPressLeftImage?: React.ReactElement;
59+
buttonPressRightImage?: React.ReactElement;
60+
buttonStyle?: StyleProp<ViewStyle>;
61+
buttonPressStyle?: StyleProp<ViewStyle>;
62+
inputStyle?: StyleProp<ViewStyle>;
63+
style?: StyleProp<ViewStyle>;
64+
append?: React.ReactElement;
65+
prepend?: React.ReactElement;
66+
decimalSeparator?: string;
67+
containerProps?: object;
68+
inputProps?: object;
69+
leftButtonProps?: object;
70+
rightButtonProps?: object;
71+
}
72+
export default class InputSpinner extends Component<ReactNativeInputSpinnerProps> {}

0 commit comments

Comments
 (0)