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

react-native-formik throws an error and doesn't work AT ALL with Formik v2 #146

Closed
alkalox opened this issue Jun 15, 2020 · 6 comments
Closed

Comments

@alkalox
Copy link

alkalox commented Jun 15, 2020

This error comes when typing into any text field -
TypeError: undefined is not an object (evaluating '(i === 0 ? obj : resVal)[pathArray[i]]')

This error occurs even with the example code in README.

It seems like work on react-native-formik stopped around the time the last stable version of Formik 1.x.x came out, which was 1.5.8, the package has not been updated for Formik v2

Right now it's working with Formik@1.5.8, for anyone who wishes to use this package.

@alkalox alkalox changed the title react-native-formik doesn't seem to work AT ALL with Formik v2 react-native-formik throws an error and doesn't work AT ALL with Formik v2 Jun 15, 2020
@bramski
Copy link

bramski commented Aug 12, 2020

Is there a planned fix? Formik v2 is out for nearly a year now.

@bramski
Copy link

bramski commented Aug 12, 2020

@Almouro ? Is this library deprecated?

@elcssmouhsine
Copy link

it seems there is no active development on this repo, did anyone made a fork for it to work with v2 ?

@Ripplz
Copy link

Ripplz commented Oct 20, 2020

@alkalox @bramski @elcssmouhsine I use this library with Formik v2.1.5 on my React Native app (Expo), and it works just fine.

From the error message, I think this has to do with an upgrade made in Formik v2^, which requires you to provide a value for each of your form elements in an object passed to your Formik component's initialValues prop.

Try this and see if it would work.

@Ripplz
Copy link

Ripplz commented Oct 20, 2020

Okay, I've successfully reproduced this error in my Formik v2+ app, and I can confirm it's what I mentioned above. You don't need to downgrade your Formik, just include the initalValues prop on your <Formik> component

@alkalox
Copy link
Author

alkalox commented Oct 21, 2020

@Ripplz Yes, you're right, that was what was missing. Thanks!

@alkalox alkalox closed this as completed Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants