formik: Invariant Violation: Element type is invalid: expected a string(for built-in components) or a class/function (for composite components) but got: object.
Current Behavior
Related to #785
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `Formik`.
This error is located at:
in Formik (at index.js:49)
in RCTView (at View.js:112)
in View (at View.js:9)
in ViewNB (at connectStyle.js:384)
in Styled(ViewNB) (at index.js:48)
in RCTView (at View.js:112)
in View (at View.js:9)
in ViewNB (at connectStyle.js:384)
in Styled(ViewNB) (at index.js:47)
in RCTView (at View.js:112)
in View (at KeyboardAvoidingView.js:184)
in KeyboardAvoidingView (at index.js:39)
in Login (at index.js:41)
in LoginForm (at SceneView.js:31)
in SceneView (at CardStack.js:405)
in RCTView (at View.js:112)
in View (at createAnimatedComponent.js:134)
in AnimatedComponent (at Card.js:26)
in Card (at PointerEventsContainer.js:55)
in Container (at CardStack.js:436)
in RCTView (at View.js:112)
in View (at CardStack.js:365)
in RCTView (at View.js:112)
in View (at CardStack.js:364)
in CardStack (at CardStackTransitioner.js:97)
in RCTView (at View.js:112)
in View (at Transitioner.js:187)
in Transitioner (at CardStackTransitioner.js:49)
in CardStackTransitioner (at StackNavigator.js:60)
in Unknown (at createNavigator.js:52)
in Navigator (at createNavigationContainer.js:216)
in NavigationContainer (at App.js:15)
in RCTView (at View.js:112)
in View (at Root.js:13)
in Root (at connectStyle.js:384)
in Styled(Root) (at App.js:14)
in App (at setup.js:39)
in StyleProvider (at setup.js:38)
in Setup (created by AwakeInDevApp)
in RCTView (at View.js:112)
in View (created by AwakeInDevApp)
in AwakeInDevApp (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:35)
in RCTView (at View.js:112)
in View (at AppContainer.js:102)
in RCTView (at View.js:112)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:34)
Steps to Reproduce
Create-React-Native-App Yarn add Formik Yarn upgrade react --latest
Expected behavior
Form should be rendered and compatible with react ^16.3
Suggested solution(s)
Downgrading solves it but not an ideal permanent solution especially when you want to use with React Context.
Additional context
Error react-native: 0.51.0, react: 16.5.2, formik: 1.3.1
No Error(downgrade) react-native: 0.51.0, react: 16.2.0, formik: 1.3.1 or react-native: 0.51.0, react: 16.5.2, formik: 0.11.11
CodeSandbox Link:
- Formik Version: 1.3.1
- React Version: 16.5.2
- TypeScript Version: Using Flow
- Browser and Version: React Native(Expo) on iPad
- OS: iOS 12.0.1
- Node Version: 8.11.4
- Package Manager and Version: Yarn 1.9.4
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 19 (2 by maintainers)
Why was this closed? I’m getting the same error using react native.
I am using formik@1.5.1 and react@16.8.3 and still getting this error.
Downgrading React to 16.7 fixed it for me.
I had the same issue—I was running formik@1.4.3 and react-dom@16.2.0. Not react-native though.
I upgraded react-dom to 16.7.0 and the issue is resolved 🎉
I resolved this by updating react-dom from 16.0.0 to 16.7.0.
Additional Context: I was running Formik 0.11.1 and updated to 1.4.3 when I saw this appear.
Same here “react”: “^16.5.2”, “formik”: “^1.3.1”,