r5n-labs / react-native-otp-inputs

OTP inputs for React-Native
MIT License
249 stars 91 forks source link

How can we restrict strings and allow only numbers to be feed as otp? #310

Open ravis-farooq opened 1 year ago

ravis-farooq commented 1 year ago

I want to use only input type number only, I set keyboardType="phone-pad" but it is taking string from clipboard when copied.

kunalsolanki1992 commented 1 year ago

Hello,

Any update on this?

shubham-imoney commented 1 year ago

I need to do this as well. Anyone has a solution?

manish-vasisst103 commented 8 months ago

I created patch for this. It will works for everyone just follow below code and patch that library.

diff --git a/node_modules/react-native-otp-inputs/src/OtpInput.tsx b/node_modules/react-native-otp-inputs/src/OtpInput.tsx index d8a2453..a5706c5 100644 --- a/node_modules/react-native-otp-inputs/src/OtpInput.tsx +++ b/node_modules/react-native-otp-inputs/src/OtpInput.tsx @@ -43,6 +43,7 @@ const OtpInput = forwardRef<TextInput, Props>( ref, ) => { const [focused, setFocused] = useState(false);