tttstudios / react-native-otp-input

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

Paste a code in iOS #97

Open mvanroon opened 4 years ago

mvanroon commented 4 years ago

Is your feature request related to a problem? Please describe. When copying an OTP from my mail client, I'd like to be able to paste in in the inputs instead of having to remember it.

Describe the solution you'd like I'd like to be able to long-press one of the inputs or the component all together and then press the 'paste' button to paste the OTP that is stored in my clipboard.

Describe alternatives you've considered An alternative would be to use React Native's App State API to detect when the user has re-entered the screen, check the contents of the clipboard and if it's an OTP, paste the result in the inputs. This would save the user from having to long-press and press 'Paste', but it could potentially paste an old OTP or something that is not an OTP at all.

Additional context I believe that a good way to achieve this (and also make the code a bit simpler) is by replacing the separate inputs with a single, invisible input that spans the entire width and height of the container. This allows for copy/pasting and disabling inputs that aren't digits.

abdullahSolace commented 1 month ago

has this feature resolved?

abdullahSolace commented 1 month ago

@mvanroon were you able to achieve this ?

mvanroon commented 1 month ago

@abdullahSolace I don't know. This is a 4 year old feature request :-)