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

标签 javascript css react-native great-circle

我正在尝试在一些文本中为 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/

相关文章:

javascript - 如何更改缩略图的样式?

HTML SVG <image> 模糊/裁剪 Angular

iOS 应用程序被拒绝 - 指南 2.3.1 - 性能

javascript - react 导航 : How to go back to root Tab Navigator with specific tab from child stack

javascript - 防止浏览器失去对外部应用程序调用的关注

jQuery UI 组合框最大宽度选项

javascript - 在异步 fs.readFile 的回调中使用 EJS 呈现 HTML 模板?

reactjs - 如何在 React Native 中向数组添加引用?

javascript - Rails 聊天实时更新(AJAX 或 WebSockets)

javascript - 使用外部javascript的html表单验证