Skip to content

Commit 17d406f

Browse files
committed
React Native OTP Text Input
1 parent 4f4a490 commit 17d406f

File tree

13 files changed

+4342
-0
lines changed

13 files changed

+4342
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

babel.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = function (api) {
2+
if (api) {
3+
api.cache(false);
4+
}
5+
6+
return {
7+
presets: ['module:metro-react-native-babel-preset'],
8+
};
9+
};

dist/OtpInput.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/OtpTextInput.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/utils/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.d.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import { ViewStyle, TextStyle } from 'react-native';
3+
4+
export interface OtpProps {
5+
/**
6+
* state variable from the parent screen
7+
*
8+
*/
9+
otp: string;
10+
/**
11+
* setState method from the parent screen
12+
*
13+
*/
14+
setOtp: React.Dispatch<React.SetStateAction<undefined>>;
15+
/**
16+
* Number of OTP digits to render
17+
*
18+
*/
19+
digits: number;
20+
21+
/**
22+
* To over-ride the default style of OTP input
23+
*
24+
*/
25+
style?: ViewStyle;
26+
27+
/**
28+
* To over-ride the dfault text style of OTP input
29+
*
30+
*/
31+
fontStyle?: TextStyle;
32+
33+
/**
34+
* To over-ride the default style of OTP input when it is focused
35+
*
36+
*/
37+
focusedStyle?: ViewStyle;
38+
}
39+
40+
41+
declare const OtpTextInput = React.FC<OtpProps>;
42+
43+
export default OtpTextInput;

0 commit comments

Comments
 (0)