react-native-navbar: RN 0.16, Invariant Violation error
When trying to reproduce the readme example, I have:
var NavigationBar = require(‘react-native-navbar’); … render() { var rightButtonConfig = { title: ‘Next’, handler: function onNext() { alert(‘hello!’); } };
var titleConfig = {
title: 'Hello, world',
};
return (
<View style={{ flex: 1, }}>
<NavigationBar
title={titleConfig}
rightButton={rightButtonConfig} />
</View>
);
}
When I try to run the example I get this error:
Unhandled JS Exception: 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 AwesomeProject.
Please help me with this
Thanks
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16 (4 by maintainers)
dsibiski [5:11 PM] @linoleum00: Make sure you are using
module.exportsin the files you are importing dsibiski [5:18 PM] ok, because I went through all of that a couple days ago…every single file needs to have “module.exports” and not rely on “export default”…if one in the chain doesn’t have it you will get that exact errorI had this conversation the other and he told me to use module.exports, and when I looked into your index.js I saw the export default line, I don’t know if this is the cause but it is worth looking at it