Reputation: 185
I have a dumb styling compile error.. Can anyone tell me the correct syntax... Here is my code...
<TouchableOpacity style={{marginRight:40}} onPress={() => this.handleBlueSelection}>
<View style={this.state.blue_selected ? {styles.team_selected} : {null}}>
<Image style={{height:30, width:30}} source={require('../../assets/images/blue.png')} />
</View>
</TouchableOpacity>
Here is the error:
TransformError SyntaxError: C:\edit_profile.js: Unexpected token, expected "," (294:54)
I know is a dumb question but cannot find the correct syntax..
Thanks
Upvotes: 0
Views: 102
Reputation: 3777
<View style={this.state.blue_selected ? {styles.team_selected} : {null}} >
styles.team_selected
and null
don't need braces around them. The reason the other style requires them is because you need to pass an object of styles (the first pair is to denote js, the second pair constructs the style object).
Upvotes: 3