jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
34k stars 2.79k forks source link

React Native Formik: Maximum call stack size exceeded on `onChange` function #3823

Open vilvaathibanpb opened 1 year ago

vilvaathibanpb commented 1 year ago

Bug report

Current Behavior

When i used the latest formik (2.4.1) with the latest RN (0.71.8), I am facing a strange issue. Whenever handleChange or handleSubmit is executed, there is an infinite loop.

With debugging I found issue in this line. When validation is ignored, by checking shouldValidate === true, the issue is gone.

I also tried debugging validations, but fieldRegistry ref stays empty and hence no validations are returned in the validateFormWithHighPriority function.

Expected behavior

It should work without entering infinite loop

Reproducible example

Suggested solution(s)

Additional context

Your environment

Software Version(s)
Formik 2.4.1
React 18.2.0
TypeScript
Browser
npm/Yarn yarn
Operating System Android (RN)
fum4 commented 1 year ago

This issue makes the latest version completely unusable 😞

Mihai1iMob commented 1 year ago

This issue makes the latest version completely unusable 😞

Indeed, because of this, I had to revert to formik@2.3.3 to be able to use it again. :(

tomkat-cr commented 1 month ago

I got the same issue after upgrade to formik@2.4.6. Going back to formik@2.4.5 fixed it...