【发布时间】:2019-06-14 10:48:13
【问题描述】:
我正在尝试在文本中使用由空格组成的占位符。当占位符位于行首或中间时,它可以正常工作,但当位于行尾时,它根本不会呈现。
<Container>
<View>
<Text style={{fontSize: 18}}>
<Text style={{ backgroundColor: 'pink' }}>
This TEXT is the first part of the sentence
</Text>
<Text style={{ backgroundColor: 'black' }}>{' '}</Text>
<Text style={{ backgroundColor: 'green' }}>
This is the second part
</Text>
</Text>
</View>
</Container >
正常行为:
奇怪的行为:
上下文:
- 在 Android 上运行
- 版本:“react”:“16.8.3”,“react-native”:“0.59.8”,
编辑:通过将普通空格字符替换为“\u00a0”字符(即“不间断空格”)解决了我的问题
【问题讨论】:
标签: android react-native mobile text