我是 RN 新手,遇到这个问题:我的页面将有 3 个部分,标题位于左侧。为了最大化空间,我希望这些标题旋转 -90 度。我的问题是,在较长的标题上,单词会中断并换行到下一行。
我可以添加 numberOfLines={1} 这会阻止换行。但现在会截断文本并添加省略号。有没有办法可以同时执行这两项操作(旋转文本而不截断文本)?
<View style={styles.budget}>
<View style={styles.boxTitle}>
<Text style={styles.titleText} numberOfLines={1}>Transform</Text>
</View>
<View style={styles.boxBody}>
<View style={styles.budgetBar}>
</View>
</View>
</View>
boxTitle: {
borderColor: 'red',
borderWidth: 2,
width: '15%',
justifyContent: 'center',
flexWrap: 'nowrap',
},
titleText: {
transform: [{ rotate: '-90deg'}],
fontSize: 20,
fontWeight: 'bold',
textDecorationLine: 'underline',
},
boxBody: {
borderWidth: 2,
width: '85%',
flexDirection: 'row'
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
424 次 |
| 最近记录: |