devfolioco / react-otp-input

:heavy_check_mark: OTP Input Component for React
http://devfolioco.github.io/react-otp-input
MIT License
654 stars 424 forks source link

how to eliminate blank spaces when pasting #382

Open VishnuPrasadhSR opened 1 year ago

VishnuPrasadhSR commented 1 year ago

The issue is that when I paste a value with whitespace, it also counts the whitespace as value. For instance, if I enter numInputs=6 and my value is space12space34space56, when I copy and paste it, it displaysspace12space34. *I tried using trim, but it didn't work. I also tried replace(/\s/g, "") , but it replaced the input value with an empty string.

prateek3255 commented 1 year ago

We can probably add another prop for this that let's you customize how the component would parse the pasted value. Would you like to work on it?