Reputation: 4517
I am trying to compile react native project. the code for the file in which error is :
import React from 'react';
import {Text,View} from 'react-native';
const Header = () =>
{
const {textStyle} =styles;
return
(
<View>
<Text style={textStyle}>Albums!</Text>
</View>
);
};
const styles = {
textStyle:{
fontSize:20
}
};
export default Header;
Upvotes: 0
Views: 588
Reputation: 8936
You're not returning anything, you have to have the open paran on the same line as the return statement.
return (
<View>
<Text style={textStyle}>Albums!</Text>
</View>
);
You can also refactor it to:
import React from 'react';
import {Text,View} from 'react-native';
const {textStyle} =styles;
const Header = () => (
<View>
<Text style={textStyle}>Albums!</Text>
</View>
)
const styles = {
textStyle:{
fontSize:20
}
};
export default Header;
Upvotes: 4