React Native 为文本添加边框
React Native add border to text
我想在我的文本组件周围添加边框。我已经完成了以下操作,但是我只想要文本周围的边框,而不是视图的整个宽度。
<View style={{borderWidth: 1}}/>
<Text>A DIFFERENT EXPERIENCE</Text>
</View>
这可能吗?
是的,您可能需要将其包装在另一个视图中,如下所示:
<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
}
干杯:)
我想在我的文本组件周围添加边框。我已经完成了以下操作,但是我只想要文本周围的边框,而不是视图的整个宽度。
<View style={{borderWidth: 1}}/>
<Text>A DIFFERENT EXPERIENCE</Text>
</View>
这可能吗?
是的,您可能需要将其包装在另一个视图中,如下所示:
<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
}
干杯:)