gpt4 book ai didi

javascript - 带有中心文本的圆形不工作 React Native iOS

转载 作者:太空宇宙 更新时间:2023-11-04 00:38:48 26 4
gpt4 key购买 nike

我正在尝试在一些文本中为 textview 绘制圆形 View 。

它可以在 Android 上运行,但是,iOS 无法正常运行。文本位于 View 顶部。

      <Text style={styles.na}> NA </Text>

styles


na: {
width: 60,
height: 60,
borderRadius: 60 / 2,
backgroundColor: 'orange',
alignItems: 'center',
textAlign: 'center',
fontWeight: 'bold',
color: 'white',
fontSize: 15,
textAlignVertical: 'center',
marginRight: 10,
overflow: 'hidden',
},

有什么建议吗?

enter image description here

最佳答案

试试这段代码,对我有用

      <View style={{
width: 60,
height: 60,
justifyContent: "center",
borderRadius: 60 / 2,
backgroundColor: 'orange',
}}>
<Text style={{
alignSelf: 'center',
fontWeight: 'bold',
color: 'white',
fontSize: 15,
}}>NA</Text>
</View>

关于javascript - 带有中心文本的圆形不工作 React Native iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58765775/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com