Skip to content

Commit a151c2d

Browse files
Merge pull request #106 from marcocesarato/copilot/fix-types-in-index-dts
Fix incorrect TypeScript function types in index.d.ts
2 parents 0bbf32c + d73e633 commit a151c2d

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/index.d.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import React, {Component} from "react";
2-
import {StyleProp, TextProps, ViewStyle} from "react-native";
2+
import {
3+
NativeSyntheticEvent,
4+
StyleProp,
5+
TextInputFocusEventData,
6+
TextInputKeyPressEventData,
7+
TextProps,
8+
ViewStyle,
9+
} from "react-native";
310

411
export interface ReactNativeInputSpinnerProps {
512
type?: string;
@@ -42,19 +49,19 @@ export interface ReactNativeInputSpinnerProps {
4249
returnKeyType?: string;
4350
width?: string | number;
4451
height?: string | number;
45-
onChange?(...args: unknown[]): unknown;
46-
onFocus?(...args: unknown[]): unknown;
47-
onBlur?(...args: unknown[]): unknown;
48-
onKeyPress?(...args: unknown[]): unknown;
49-
onMin?(...args: unknown[]): unknown;
50-
onMax?(...args: unknown[]): unknown;
51-
onIncrease?(...args: unknown[]): unknown;
52-
onDecrease?(...args: unknown[]): unknown;
53-
onSubmit?(...args: unknown[]): unknown;
54-
onLongPress?(...args: unknown[]): unknown;
52+
onChange?: (value: number | null) => void | false | number;
53+
onFocus?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void;
54+
onBlur?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void;
55+
onKeyPress?: (e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void;
56+
onMin?: (value: number) => void;
57+
onMax?: (value: number) => void;
58+
onIncrease?: (value: number) => void;
59+
onDecrease?: (value: number) => void;
60+
onSubmit?: (value: number) => void;
61+
onLongPress?: (value: number) => void;
5562
accelerationDelay?: number;
56-
delayPressIn?: number,
57-
delayPressOut?: number,
63+
delayPressIn?: number;
64+
delayPressOut?: number;
5865
speed?: number;
5966
emptied?: boolean;
6067
continuity?: boolean;
@@ -81,6 +88,6 @@ export interface ReactNativeInputSpinnerProps {
8188
leftButtonProps?: object;
8289
rightButtonProps?: object;
8390
buttonTextProps?: TextProps;
84-
formatter?(...args: unknown[]): unknown;
91+
formatter?: (value: number) => string;
8592
}
8693
export default class InputSpinner extends Component<ReactNativeInputSpinnerProps> {}

0 commit comments

Comments
 (0)