首页 > 解决方案 > React Native:Text 组件的最后一个单词/字符在 Android 上消失(不在 IOS 上)

问题描述

我的应用中有一个带有样式的简单文本组件。如果我添加 fontweight: 'bold',最后一个字符(有时是整个单词)就会消失。

两个示例文本组件:

<Text style={styles.price}>{priceDisplay(deal.price)}</Text>
<Text style={styles.cause}>{deal.cause.name}</Text>

这两个的样式:

  cause: {
    fontSize: 14,
    fontWeight: 'bold',
  },
  price: {
    fontSize: 16,
    textAlign: 'center',
    fontWeight: 'bold',
  },

没有 fontweight
有 fontweight \

提前致谢。

编辑:问题来自我的 OnePlus 智能手机,它以 OnePlus-Slate 字体为标准。该字体会导致问题。如果我将代码中的字体更改为“Roboto”之类的字体,则字体粗体将起作用。

标签: react-nativereact-native-androidreact-native-stylesheet

解决方案



推荐阅读