如何
<Text> some text </Text>在反应原生中设置为大写
<Text style={{}}> Test </Text>
Run Code Online (Sandbox Code Playgroud)
需要证明Test as TEST.
Thi*_*vya 101
@Cherniv谢谢你的回答
<Text style={{}}> {'Test'.toUpperCase()} </Text>
Run Code Online (Sandbox Code Playgroud)
Bla*_*ack 71
iOS textTransform支持已添加到0.56版本的react-native中.它接受以下选项之一:
例:
<View>
<Text style={{ textTransform: 'uppercase'}}>
This text should be uppercased.
</Text>
<Text style={{ textTransform: 'capitalize'}}>
Mixed:{' '}
<Text style={{ textTransform: 'lowercase'}}>
lowercase{' '}
</Text>
</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
更新: 支持已添加到0.57.4的Android中,但有一个错误,请参阅GitHub问题
React Native .toUpperCase() 函数在字符串中工作正常,但如果您使用numbersor other non-string data types,它不起作用。该error会时有发生。
下面两个是字符串属性:
<Text>{props.complexity.toUpperCase()}</Text>
<Text>{props.affordability.toUpperCase()}</Text>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
63165 次 |
| 最近记录: |