Reputation: 44550
I'm new to React Native EStyleSheet lib. I find it's really cool, but one thing that I can't figure out is, how to apply multiple styles to a single element just like I used to do with regular styles with style={{...styles.style1, ...styles.style2}}
?
render() {
return <View style={estyles.container}>
<View style={{...estyles.container, ...estyles.containerInner}}>
<Text>Hello, World!</View>
</View>
<View>
}
const estyles = EStyleSheet.create({
container: {
padding: '2%',
borderStyle: 'solid',
borderRadius: 1,
borderWidth: 1,
borderColor: 'black'
},
containerInner: {
padding: '5%'
}
});
Upvotes: 0
Views: 2595
Reputation: 2065
You can use array of styles to apply multiple styles to single view
example
<View style={[styles.container, styles.view,...]}>
</View>
Upvotes: 1
Reputation: 21
you can used in style array of styles for example:
render() {
return <View style={estyles.container}>
<View style={[estyles.container,estyles.containerInner]}>
<Text>Hello, World!</View>
</View>
<View>
}
const estyles = EStyleSheet.create({
container: {
padding: '2%',
borderStyle: 'solid',
borderRadius: 1,
borderWidth: 1,
borderColor: 'black'
},
containerInner: {
padding: '5%'
}
});
this => [estyles.container,estyles.containerInner] can used
Upvotes: 0