参考文档
Props
color
fontFamily
iOS 上支持通用字体族 system-ui、ui-sans-serif、ui-serif、ui-monospace 和 ui-rounded。
fontSize
fontStyle
| 类型 |
|---|
enum('normal', 'italic') |
fontWeight
指定字体粗细。大多数字体支持 'normal' 和 'bold' 值。并非所有字体都有每个数值对应的变体,在这种情况下会选择最接近的值。
| 类型 | 默认值 |
|---|
enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900') or number | 'normal' |
includeFontPadding
Android
设置为 false 可移除为某些升部/降部预留的额外字体内边距。在某些字体下,此内边距可能导致文本在垂直居中时看起来略微偏移。为获得最佳效果,建议同时将 textAlignVertical 设置为 center。
fontVariant
允许你设置字体的所有变体。可以通过枚举数组或空格分隔的字符串来设置,例如 'small-caps common-ligatures'。
| 类型 | 默认值 |
|---|
array of enum('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums') or string | [] |
letterSpacing
增加或减少字符间距。默认没有额外的字母间距。
lineHeight
控制文本元素中行间垂直间距的数值。指定连续文本行基线之间的距离。
textAlign
指定文本对齐方式。在 Android 上,'justify' 值仅在 Oreo(8.0)及以上版本(API 级别 >= 26)上支持。在更低版本的 Android 上会回退为 left。
| 类型 | 默认值 |
|---|
enum('auto', 'left', 'right', 'center', 'justify') | 'auto' |
textAlignVertical
Android
| 类型 | 默认值 |
|---|
enum('auto', 'top', 'bottom', 'center') | 'auto' |
textDecorationColor
iOS
textDecorationLine
| 类型 | 默认值 |
|---|
enum('none', 'underline', 'line-through', 'underline line-through') | 'none' |
textDecorationStyle
iOS
| 类型 | 默认值 |
|---|
enum('solid', 'double', 'dotted', 'dashed') | 'solid' |
textShadowColor
textShadowOffset
| 类型 |
|---|
object: {width?: number, height?: number} |
textShadowRadius
textTransform
| 类型 | 默认值 |
|---|
enum('none', 'uppercase', 'lowercase', 'capitalize') | 'none' |
verticalAlign
Android
| 类型 | 默认值 |
|---|
enum('auto', 'top', 'bottom', 'middle') | 'auto' |
writingDirection
iOS
| 类型 | 默认值 |
|---|
enum('auto', 'ltr', 'rtl') | 'auto' |
userSelect
允许用户选择文本并使用原生的复制粘贴功能。优先级高于 selectable 属性。
| 类型 | 默认值 |
|---|
enum('auto', 'text', 'none', 'contain', 'all') | none |