Open oronbz opened 9 years ago
I had this error when I had a typo in module.exports = ComponentName;
(forgot the "s" in exports)
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
@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;
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!
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');
I had this problem when I had written "AppRegistry" rather than "export default",while I use this component ,it's happened.
Hi, I'm getting:
when trying to use the carousel module, any idea what's going on here?