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

Primereact Reusable component: Issue integrating InputNumber with formik #3684

Open
DarioArena87 opened this issue Nov 21, 2022 · 0 comments

Comments

@DarioArena87
Copy link

Bug report

Hi, i'm trying to create Formik bindings for the PrimeReact library creating some reusable components as described in the last part of https://formik.org/docs/tutorial#leveraging-react-context. Everything worked perfectly except for the InputNumber component for which i asked PrimeReact's team if i was doing something wrong or there is a bug in my code.
I've described the problem in the original issue but basically there is some strange behavior when validating InputNumber content and it seems like the validation is "lagging" one step behind the user input.
I'll paste the original code sandbox example here too

https://codesandbox.io/s/primereact-test-forked-ith2lx?file=/src/index.js

If i'm doing something really wrong feel free to correct me and if i wasn't clear ask me all the question nedded.

Current Behavior

In the code sandbox:

  1. Click on the InputNumber and insert a number (1)
  2. Click outside of the InputNumber
  3. Click on the InputNumber and delete the number
  4. Click outside of the InputNumber
  5. No validation error is shown
  6. Click on the InputNumber
  7. Click outside of the InputNumber
  8. Validation error is shown

Expected behavior

  1. Click on the InputNumber and insert a number (1)
  2. Click outside of the InputNumber
  3. Click on the InputNumber and delete the number
  4. Click outside of the InputNumber
  5. A validation error is shown

Your environment

Software Version(s)
Formik 2.2.9
React 18.2.0 (tried also 16.0.x in code sandbox)
Browser Chrome/Firefox
npm/Yarn Npm 8.19.3
Operating System Windows/Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant