Reputation: 223
Im new in react native,
before in my code using const Main = () => { ..}
but when i change to export default class Main extends React.Component { ..}
, problems arise like style in View not working but the error ',' expected in style
Screnshoot :
im using new version of react native
Upvotes: 0
Views: 164
Reputation: 1274
You are missing the render() method where the return() method should be.
Ex:
export default class LotsOfStyles extends Component {
render() {
return (
<View>
<Text style={styles.red}>just red</Text>
<Text style={styles.bigBlue}>just bigBlue</Text>
<Text style={[styles.bigBlue, styles.red]}>bigBlue, then red</Text>
<Text style={[styles.red, styles.bigBlue]}>red, then bigBlue</Text>
</View>
);
}
}
from react native docs
Upvotes: 2