tttstudios / react-native-otp-input

Tiny Javascript library which provides an elegant UI for user to input one time passcode.
MIT License
528 stars 239 forks source link

Add a max length of 1 for each individual input #130

Open Scrabouillmax opened 3 years ago

Scrabouillmax commented 3 years ago

Issue A single input (typically the last input) can contain several digits in some situations.

Reproduction

When the user enters the code and the callback execution is slightly delayed, a single input can contain several digits. This causes flickering and potentially inconsistent behaviour.

This is the most efficient fix to guarantee that each input cannot contain more than 1 digit at any given time. I could not see any issue with this, but let me know if otherwise.

In any case, thanks a lot for this library, it's really useful!

hirbod commented 2 years ago

This will break the iOS OTP insert from messages.