小编Kev*_*man的帖子

如何防止 React Native 中的断字?

这似乎是一个显而易见的问题,但我不知道如何防止 React Native Text 组件在不适合容器宽度时破坏单个单词,同时保持一般的换行。断词似乎是一种奇怪的默认行为 - 我该如何防止它?

这是一些示例代码:

  <View style={{
    width: 35,
    height: 35,
  }}>
    <Text
      style={{
        flex: 1,
        // flexWrap: "nowrap", // did nothing
        // flexShrink: 1, // did nothing
        fontSize: 10,
        lineHeight: 16,
        // whiteSpace: "nowrap", // did nothing
      }}
    >Hereisareallylongwordina block with shorter words.</Text>
  </View>
Run Code Online (Sandbox Code Playgroud)

react-native

7
推荐指数
1
解决办法
1380
查看次数

标签 统计

react-native ×1