formik: Crash with React Native
Reopened #894 because it was closed by mistake
@jaredpalmer Please try out the branch and look the picture of the error I took. As you can see the crash wasn’t because of wrong documentation. So please don’t close this before validating 😃
Current Behavior
When using Formik with React Native the app will crash. Here is minimal code for reproduction https://github.com/henrikra/formikTest/blob/master/App.js
Steps to Reproduce
Make fresh React Native project and add the code from example: https://jaredpalmer.com/formik/docs/guides/react-native
Expected behavior
I expect the app not to crash when using Formik
Suggested solution(s)
I have no idea how to solve this at the moment. Looks like React Native doesn’t have context
object?
Additional context
Here is minimal reposity to reproduce this crash: https://github.com/henrikra/formikTest/blob/master/App.js
- Formik Version: 1.2.0
- React Native Version: 0.54.4
- TypeScript Version: 3.0.1
- OS: OSX
- Node Version: 8.11.3
- Package Manager and Version: Npm version 5.6.0
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (7 by maintainers)
While we are on the same topic, I just done further research. It is still possible to remain v0.54.4 BUT have to revert react version to “react”: “16.3.0” since: 16.3.1+ changed the way context works
facebook/react@ba245f6
@jaredpalmer @henrikra I checked out @henrikra’s test repo and I encountered the exact same issue in my project. My initial thought was probably something to do with the react native version v0.54.4 as both of us are using v0.54.4 and the error was throwing at ReactNativeRenderer.
So I’ve done a few tests, I upgraded the version to v0.56.1 on Henrik’s repo and in order to make it compile I also have to upgrade “babel-preset-react-native” to “5.0.2”.
so the following works:
… “dependencies”: { “formik”: “^1.2.0”, “react”: “16.5.0”, “react-native”: “0.56.1” }, “devDependencies”: { “babel-jest”: “23.6.0”, “babel-preset-react-native”: “5.0.2”, “jest”: “23.6.0”, “react-test-renderer”: “16.5.0” …
Now v0.54.4 to v0.56.1 is quite a big jump in terms of upgrading my project (a few breaking changes here and there; dropping iOS 8 support etc), I was hoping to see if Formik can support ‘slightly’ older version of react-native
Thanks!