question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Current 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
hasseiocommented, Oct 19, 2018

You forgot to import View component in MyCallsScreen.js

0reactions
Eljoycommented, Oct 19, 2018

The issue was resolved by updating react-native and react to version 0.55.4 and 16.3.1 respectively.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found