Comments (4)
Thank you for the kind words.
I like your proposal, because most of the time we're probably interested in complete values only and I've seen many people check for the length in the onChange
handler.
You can go ahead and implement it if you want.
As for the naming, I can't think of anything else. So we can go with that, I guess.
from react-verification-input.
Hey, @andreaswilli!
Thank you for the reply! I added this to my doing list, and I'll try to work on that during this weekend.
Just so we can be on the same page: my initial idea was to check if the newInputVal.length
is equal to the length
. If true, check if the onComplete
prop exists and then call it. What do you think about this approach?
react-verification-input/src/index.js
Lines 52 to 57 in cd1394d
if (RegExp(`^[${validChars}]{0,${length}}$`).test(newInputVal)) {
if (onChange) {
onChange?.(newInputVal);
}
setLocalValue(newInputVal);
+ if (newInputVal.length === length) {
+ onComplete?.(newInputVal)
+ }
}
Let me know if you think there is a better approach!
from react-verification-input.
Looks good to me 👍🏼
from react-verification-input.
Released v3.3.0
from react-verification-input.
Related Issues (20)
- Fix broken github status badge
- Error when building in vite app HOT 5
- Edge Browser Hide Password Toggle
- Needs ability to style the `vi__wrapper` div HOT 12
- OTP Autocomplete issue (Safari) HOT 2
- Can support the function of copying and pasting shortcut keys? HOT 2
- how to disable input during validation? HOT 2
- Safari autocomplete problem HOT 1
- Input still has "vi__character--selected" class after disabling input through inputProps HOT 3
- Request: Ability to select specific characters for deletion in OTP Input. HOT 1
- Fix "mobile zoom" not working like regular input fields
- Meta tag info (README): make sure this is up to date and consider removing user-scalable=no
- disable spell check HOT 1
- broken input styles HOT 1
- adding custom class names should not remove default class names HOT 1
- Manually selecting one of the fields HOT 1
- Can't type or paste this code: 008003 HOT 2
- Add caret HOT 3
- enable syntax highlighting on docs website
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-verification-input.