Skip to content

Commit

Permalink
add editable params
Browse files Browse the repository at this point in the history
  • Loading branch information
anhquan291 committed Dec 4, 2023
1 parent 1de3787 commit 2b81b43
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const OTPInput = () => {
}
```

## Parameters
## Params

| Parameter | required | Description |
| ----------------------- | -------- | ----------------------------------------------------------------------------------------------- |
Expand All @@ -60,6 +60,7 @@ const OTPInput = () => {
| autoFocus | NO | Auto activate the input and bring up the keyboard when component is loaded |
| onCodeChanged | NO | Callback when the digits are changed |
| onCodeFilled | NO | Callback when the last digit is entered |
| editable | NO | Set editable for inputs |
| rest | NO | The other text input props |
| enteringAnimated | NO | The entering animation using reanimated layout |
| exitingAnimated | NO | The exiting animation using reanimated layout |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-animated-otp-input",
"version": "0.1.4",
"version": "0.1.5",
"description": "@anhquan291/react-native-animated-otp-input is a tiny library which provides an elegant UI with smooth Animation for the end user to input one time passcode (OTP). It also handles the input suggestion on iOS when the OTP SMS is received.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
4 changes: 4 additions & 0 deletions src/Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export interface IOtpInput extends TextInputProps {
* If keyboard is automatically brought up when OTP is loaded.
*/
autoFocus?: boolean;
/**
* Set editable for inputs
*/
editable?: boolean;
/**
* Callback function
* Trigger when all text input fields are fulfill
Expand Down
5 changes: 4 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const OtpItem = ({ i }: { i: number }) => {
inputStyle,
textStyle,
otpCount,
editable,
enteringAnimated,
exitingAnimated,
rest,
Expand Down Expand Up @@ -74,7 +75,7 @@ const OtpItem = ({ i }: { i: number }) => {
autoFocus={autoFocus && i === 0}
{...rest}
/>
<Pressable onPress={onPress} style={styles.overlay}>
<Pressable disabled={editable} onPress={onPress} style={styles.overlay}>
<Animated.View
style={[
{
Expand Down Expand Up @@ -108,6 +109,7 @@ export const OtpInput = ({
textStyle = {},
focusColor = '#4497ce',
autoFocus = false,
editable = true,
enteringAnimated = FadeInDown,
exitingAnimated = FadeOut,
onCodeFilled,
Expand Down Expand Up @@ -174,6 +176,7 @@ export const OtpInput = ({
textStyle,
focusColor,
otpCount,
editable,
enteringAnimated,
exitingAnimated,
rest,
Expand Down

0 comments on commit 2b81b43

Please sign in to comment.