I was facing the same issue described here:
https://github.com/s-yadav/react-number-format/issues/277
Right after I applied suggestions, I faced a weird behavior:
Check codebox below:
https://codesandbox.io/s/zn84pljwo3
Steps to reproduce:
1 - Fill both inputs (12 for example)
2 - Click on R$ button
Expected Behaviour:
Both inputs are cleared.
Current Behaviour:
Only first input is cleared
Whenever initialValues is changed enableReinitialize forces all inputs to be reseted to initialValues (null).
However, If I have a dynamic prefix...
Right after the onChange that sets react-number-format to null (initialValues), another onChange is triggered with the old State.
Any thoughts on that?
Formik is calling the renderProps twice synchronously in one execution cycle once with the prefix change and once with reset values.
This causing the following flow for the number format.
I feel that the fix should happen on the Formik side. It should either batch the updates, or call the render props in different ticks. But I will see if I can do anything for the fix.
Gotcha.
I appreciate your time.
Thank you so much!
This is fixed in 4.4.1.
Most helpful comment
Formik is calling the renderProps twice synchronously in one execution cycle once with the prefix change and once with reset values.
This causing the following flow for the number format.
I feel that the fix should happen on the Formik side. It should either batch the updates, or call the render props in different ticks. But I will see if I can do anything for the fix.