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 'NavigatorIOS'.
Here is my code
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
import React, {
AppRegistry,
StyleSheet,
NavigatorIOS,
View,
Text,
} from 'react-native';
var Dashboard = require('./App/Views/Dashboard/index.ios.js');
class HackerNews extends React.Component {
render() {
return (
<NavigatorIOS style={styles.container}
tintColor='#FF6600'
initialRoute={{
title: 'Hacker News',
Component: Dashboard,
}}/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F6F6FF',
},
});
AppRegistry.registerComponent('HackerNews', () => HackerNews);
Dashboard code:
'use strict';
import React, {
StyleSheet,
Text,
View,
TouchableHighlight,
} from 'react-native';
//var api = require("../../Network/api.js");
//var Post = require("../Post/index.ios.js");
export default class Dashboard extends React.Component {
constructor(props){
super(props);
this.state = {
topStoryIDs: null,
lastIndex: 0
};
}
render(){
return(
<View>
<Text>Dashboard Testing</Text>
</View>
);
}
}
Updates:
figured it out. component should be lowercase.
Already @qinking126 able to solve this problem and he commented his answer.
I am just highlighting his Answer Here.
<NavigatorIOS style={styles.container}
tintColor='#FF6600'
initialRoute={{
title: 'Hacker News',
Component: Dashboard,
}}/>
Here Component should be in lowercase
Like this:- component: Dashboard,
Thanks to qinking126
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With