erikras / react-native-listener

A utility component to allow easy access to browser native events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

Aryk opened this issue · comments

I'm probably missing something really obvious here, but I keep getting this error.

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `StatelessComponent`.
    at invariant (invariant.js:38)
    at instantiateReactComponent (instantiateReactComponent.js:70)
    at Object.updateChildren (ReactChildReconciler.js:118)
    at ReactDOMComponent._reconcilerUpdateChildren (ReactMultiChild.js:210)
    at ReactDOMComponent._updateChildren (ReactMultiChild.js:314)
    at ReactDOMComponent.updateChildren (ReactMultiChild.js:301)
    at ReactDOMComponent._updateDOMChildren (ReactDOMComponent.js:942)
    at ReactDOMComponent.updateComponent (ReactDOMComponent.js:760)
    at ReactDOMComponent.receiveComponent (ReactDOMComponent.js:718)
    at Object.receiveComponent (ReactReconciler.js:126)

Running react 15.3.2

Loading it in which import NativeListener from 'react-native-listener';

It does load in the library successfully but when I wrap any react component with it I get this error.

Nevermind, I found the answer, had to import it as:

import * as NativeListener from 'react-native-listener';

What you have in your example does not work for certain users.