Skip to content

Commit 7987a71

Browse files
committed
chore: add missing types to index.d.ts
1 parent 803b48d commit 7987a71

File tree

1 file changed

+73
-2
lines changed

1 file changed

+73
-2
lines changed

src/index.d.ts

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
declare module "OTPInput" {
2-
import { ColorValue, TextStyle, ViewStyle } from "react-native";
2+
import { ColorValue, TextInputProps, TextStyle, ViewStyle } from "react-native";
33

44
export interface OtpEntryProps {
55
/**
@@ -32,6 +32,57 @@ declare module "OTPInput" {
3232
* The duration (in milliseconds) for the focus stick to blink.
3333
*/
3434
focusStickBlinkingDuration?: number;
35+
36+
/**
37+
* A callback function that is invoked when the OTP entry is filled.
38+
* It receives the filled OTP text as an argument.
39+
*/
40+
onFilled?: (text: string) => void;
41+
42+
/**
43+
* A callback function that is invoked when the OTP entry is focused.
44+
*/
45+
onFocus?: () => void;
46+
47+
/**
48+
* A callback function that is invoked when the OTP entry is blurred.
49+
*/
50+
onBlur?: () => void;
51+
52+
/**
53+
* A flag to determine whether the OTP entry should blur when it is filled.
54+
*/
55+
blurOnFilled?: boolean;
56+
57+
/**
58+
* A flag to determine whether the focus stick should be hidden.
59+
*/
60+
hideStick?: boolean;
61+
62+
/**
63+
* A flag to determine whether the OTP entry should be in secure text entry mode.
64+
*/
65+
secureTextEntry?: boolean;
66+
67+
/**
68+
* A flag to determine whether the OTP entry is disabled.
69+
*/
70+
disabled?: boolean;
71+
72+
/**
73+
* Additional props to be passed to the `TextInput` component.
74+
*/
75+
textInputProps?: TextInputProps;
76+
77+
/**
78+
* The type of characters allowed in the OTP entry.
79+
*/
80+
type?: "alpha" | "numeric" | "alphanumeric";
81+
82+
/**
83+
* The placeholder text to be displayed in the OTP entry.
84+
*/
85+
placeholder?: string;
3586
}
3687

3788
export interface OtpInputRef {
@@ -64,7 +115,7 @@ declare module "OTPInput" {
64115
inputsContainerStyle?: ViewStyle;
65116

66117
/**
67-
* Custom styles for the container that wraps each individual digit in the OTP entry.
118+
* Custom styles for the container(s) that wraps each individual digit in the OTP entry.
68119
*/
69120
pinCodeContainerStyle?: ViewStyle;
70121

@@ -77,5 +128,25 @@ declare module "OTPInput" {
77128
* Custom styles for the focus stick, which indicates the focused input field.
78129
*/
79130
focusStickStyle?: ViewStyle;
131+
132+
/**
133+
* Custom styles for the container(s) of the filled digit in the OTP entry.
134+
*/
135+
filledPinCodeContainerStyle?: ViewStyle;
136+
137+
/**
138+
* Custom styles for the container of the focused digit in the OTP entry.
139+
*/
140+
focusedPinCodeContainerStyle?: ViewStyle;
141+
142+
/**
143+
* Custom styles for the container(s) of the disabled digit in the OTP entry.
144+
*/
145+
disabledPinCodeContainerStyle?: ViewStyle;
146+
147+
/**
148+
* Custom styles for the placeholder text in the OTP entry.
149+
*/
150+
placeholderTextStyle?: TextStyle;
80151
}
81152
}

0 commit comments

Comments
 (0)