Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with last input field #91

Closed
salmabader opened this issue Feb 12, 2024 · 5 comments
Closed

Issue with last input field #91

salmabader opened this issue Feb 12, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@salmabader
Copy link

salmabader commented Feb 12, 2024

Hi 👋🏻,

Firstly, thanks for your efforts in this library, it is really useful

I faced an issue with the last input field, when I try to clear it, the last two fields are cleared and this causes calling the onComplete twice.
I tried to figure out the issue, but I didn't reach any solution :(

  • I'm using React with Next.js and Tailwind and I'm calling a custom function onComplete: onComplete={handleVerify}
    <PinField autoFocus ref={codeRef} onComplete={handleVerify} className='w-full rounded-md text-center placeholder:text-xs placeholder:text-gray-300 bg-my-gray border-gray-300 transition-all ease-soft-spring focus:shadow-md focus:ring-1 focus:shadow-sky-200 focus:outline-none hover:bg-my-200' id="code" placeholder='○' validate={/^[0-9]$/} />

ezgif-8-560513cd79

@soywod
Copy link
Owner

soywod commented Feb 13, 2024 via email

@salmabader
Copy link
Author

I just try it on production and it is working properly
I'm facing this issue on my local only

@soywod
Copy link
Owner

soywod commented Feb 23, 2024 via email

@soywod
Copy link
Owner

soywod commented Jan 2, 2025

Duplicate #92 confirmed, a fix is on its way.

@soywod soywod closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2025
@soywod soywod added the duplicate This issue or pull request already exists label Jan 2, 2025
soywod added a commit that referenced this issue Jan 3, 2025
The Strict Mode story revealed an issue in the conception. A refactor
is needed.

Refs: #91
@soywod
Copy link
Owner

soywod commented Jan 7, 2025

I dived a bit more into this issue, and it turns out that it is not a duplicate of #92. Although it is related to it: the React strict mode revealed a misconception in the structure of the PIN field, which led to the issue you encountered on the last input. I needed to refactor a lot of things, see #94.

I just released the v4.0.0 which includes the fix (but also breaking changes, see CHANGELOG).

@soywod soywod closed this as completed Jan 7, 2025
@soywod soywod added bug Something isn't working and removed duplicate This issue or pull request already exists labels Jan 7, 2025
@soywod soywod self-assigned this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants