nick / react-native-carousel

Carousel component for react-native
MIT License
458 stars 107 forks source link

React native 0.10.1 support #20

Open oronbz opened 9 years ago

oronbz commented 9 years ago

Hi, I'm getting:

Error: Invariant Violation: 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 `ReactStrap`.
 stack: 
  instantiateReactComponent                          index.ios.bundle:8188
  Object.ReactChildReconciler.instantiateChildren    index.ios.bundle:22284
  ReactMultiChild.Mixin.mountChildren                index.ios.bundle:21993
  ReactNativeBaseComponent.Mixin.initializeChildren  index.ios.bundle:19306
  ReactNativeBaseComponent.Mixin.mountComponent      index.ios.bundle:19471
  Object.ReactReconciler.mountComponent              index.ios.bundle:6696
  ReactCompositeComponentMixin.mountComponent        index.ios.bundle:8494
  wrapper [as mountComponent]                        index.ios.bundle:5858
  Object.ReactReconciler.mountComponent              index.ios.bundle:6696
 URL: undefined
 line: undefined
 message: Invariant Violation: 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 `ReactStrap`.

when trying to use the carousel module, any idea what's going on here?

thorbenandresen commented 9 years ago

I had this error when I had a typo in module.exports = ComponentName; (forgot the "s" in exports)

ignivanishant commented 9 years ago

hi everyone i am new to react native i just write react-native code in sublime editor

use strict';

var React = require('react-native'); var { AppRegistry, TabBarIOS, NavigatorIOS } = React;

var simple = React.createClass({ render: function() { return (

);

} }); AppRegistry.registerComponent('simple', () => simple);

and getting error : Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.help me if you can

Thanks in advance

olitomas commented 9 years ago

@ignivanishant you need to return something (inside of the return). Example:

return(
    <Text>Hello world!</Text>
);

For this to work you would also need to add "Text" to :

var {
AppRegistry,
TabBarIOS, 
NavigatorIOS,
Text   <----------------------
} = React;
aymericbouzy commented 8 years ago

I had this issue because i had written

import {foo} from './foo'

where my foo.js file read

export default foo

writing import foo from './foo' fixed it. Hope this helps!

joshuapinter commented 8 years ago

Similar problem as @aymericbouzy except I was including LInearGradient like this:

var LinearGradient = require('react-native-linear-gradient');

Changing it to this worked:

import LinearGradient from 'react-native-linear-gradient');
liubobuzhidao commented 8 years ago

I had this problem when I had written "AppRegistry" rather than "export default",while I use this component ,it's happened.