Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
See original GitHub issueCurrent behaviour
As a result of wrapping my component with PaperProvider
I’ve got the following error:
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
Portal.Host
.This error is located at: in Portal.Host (at Provider.js:16) in Provider (at MyCallsWrapper.js:7) in MyCallsWrapper (at renderApplication.js:35) in RCTView (at View.js:71) in View (at AppContainer.js:102) in RCTView (at View.js:71) in View (at AppContainer.js:122) in AppContainer (at renderApplication.js:34)
Code sample
MyCallsWrapper.js
import * as React from 'react';
import MyCallsScreen from "./MyCalls";
import {Provider as PaperProvider} from 'react-native-paper';
export default function MyCallsWrapper(props) {
return (
<PaperProvider>
<MyCallsScreen userTags={props.userTags} phone_id={props.phone_id}/>
</PaperProvider>
)
}
MyCallsScreen.js
import React from "react";
import PropTypes from 'prop-types';
import {
StyleSheet,
View,
InteractionManager
} from 'react-native';
export default class MyCallsScreen extends React.Component {
// some logic
render() {
return (
<View style={styles.container}>
// some content
</View>
)
}
}
inside index.js
AppRegistry.registerComponent('MyCalls', () => MyCallsWrapper);
Your Environment
software | version |
---|---|
ios or android | android |
react-native | 0.53.0 |
react-native-paper | 2.1.3 |
node | 10.8.0 |
npm or yarn | 6.4.1 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Invariant Violation: Element type is invalid: expected a string ...
Uncaught Error : Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got ......
Read more >Element type is invalid: expected a string (for built-in ... - GitHub
createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Read more >Element type is invalid: expected a string (for built-in ... - Reddit
Getting Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ...
Read more >Element type is invalid: expected a string (for built-in ...
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. edit.js :
Read more >Element type is invalid: expected a string (for ... - OneCompiler
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You forgot to import View component in MyCallsScreen.js
The issue was resolved by updating react-native and react to version 0.55.4 and 16.3.1 respectively.