参考
Props
color
fontFamily
支持 iOS 上的通用字体族 system-ui、ui-sans-serif、ui-serif、ui-monospace 和 ui-rounded。
fontSize
fontStyle
| Type |
|---|
enum('normal', 'italic') |
fontWeight
指定字体粗细。对于大多数字体,支持 'normal' 和 'bold' 两个值。并非所有字体都对每个数值都有对应的变体,在这种情况下会选择最接近的一个。
| Type | Default |
|---|
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'。
| Type | Default |
|---|
array of enum('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums') or string | [] |
letterSpacing
增加或减少字符之间的间距。默认没有额外的字母间距。
lineHeight
控制文本元素内文本行之间垂直间距的数值。它指定连续文本行基线之间的距离。
textAlign
指定文本对齐方式。在 Android 上,值 'justify' 仅支持 Oreo(8.0)或更高版本(API level >= 26)。在较低版本的 Android 上,该值将回退为 left。
| Type | Default |
|---|
enum('auto', 'left', 'right', 'center', 'justify') | 'auto' |
textAlignVertical
Android
verticalAlign 样式属性的别名,如果同时使用这两个属性,verticalAlign 将优先于 textAlignVertical
| Type | Default |
|---|
enum('auto', 'top', 'bottom', 'center') | 'auto' |
textDecorationColor
iOS
textDecorationLine
| Type | Default |
|---|
enum('none', 'underline', 'line-through', 'underline line-through') | 'none' |
textDecorationStyle
iOS
| Type | Default |
|---|
enum('solid', 'double', 'dotted', 'dashed') | 'solid' |
textShadowColor
textShadowOffset
| Type |
|---|
object: {width?: number, height?: number} |
textShadowRadius
textTransform
| Type | Default |
|---|
enum('none', 'uppercase', 'lowercase', 'capitalize') | 'none' |
verticalAlign
Android
| Type | Default |
|---|
enum('auto', 'top', 'bottom', 'middle') | 'auto' |
writingDirection
iOS
| Type | Default |
|---|
enum('auto', 'ltr', 'rtl') | 'auto' |
userSelect
它允许用户选择文本并使用原生复制和粘贴功能。其优先级高于 selectable 属性。
| Type | Default |
|---|
enum('auto', 'text', 'none', 'contain', 'all') | none |