I have been following a tutorial with React Native and emulating the result using Xcode's iPhone emulator, however I'm stuck on this error message and cannot see what's wrong. I have another file which is importing this component to be within the NavigatorIOS component.
var React = require('react-native');
var {
View,
StyleSheet,
Text
} = React;
var styles = StyleSheet.create ({
mainContainer: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
backgroundColor: '#eee'
}
});
class Main extends React.Component {
render: function() {
return (
<Text>
Hello
</Text>
)
}
};
module.exports = Main;
Inside class bodies, methods are declared with
render() { ... }
not
render: function() { ... }
See the MDN documentation for more information.
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