Reputation: 2453
I want to add a border around my Text component. I've done the following, however I only want the border around the text, not the full width of the View.
<View style={{borderWidth: 1}}/>
<Text>A DIFFERENT EXPERIENCE</Text>
</View>
Is this possible?
Upvotes: 1
Views: 5615
Reputation: 3384
Yes it is possible for that you need to wrap it in another view like this:
<View style={styles.container}>
<View style={styles.inner}>
<Text>A DIFFERENT EXPERIENCE</Text>
</View>
</View>
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
borderWidth:4
},
inner:{
borderWidth:4
}
Cheers:)
Upvotes: 3