跳到主要内容
版本:0.78

文本样式属性

示例​

参考

属性​

color​

类型
color

fontFamily​

类型
string

通用字体族 system-ui、ui-sans-serif、ui-serif、ui-monospace 和 ui-rounded 在 iOS 上受支持。


fontSize​

类型
number

fontStyle​

类型
enum('normal', 'italic')

fontWeight​

指定字体粗细。大多数字体支持值 'normal' 和 'bold'。并非所有字体都有每个数值对应的变体,在这种情况下会选择最接近的一个。

类型默认值
enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900') 或 number'normal'

includeFontPadding
Android
​

设置为 false 以移除额外的字体内边距,这些内边距旨在为某些上升部/下降部留出空间。对于某些字体,当垂直居中时,此内边距会使文本看起来略微未对齐。为了获得最佳效果,还将 textAlignVertical 设置为 center。

类型默认值
booltrue

fontVariant​

允许你设置字体的所有字体变体。可以通过使用枚举数组或空格分隔的字符串来设置,例如 'small-caps common-ligatures'。

类型默认值

enum('common-ligatures', 'contextual', 'discretionary-ligatures', 'historical-ligatures', 'lining-nums', 'no-common-ligatures', 'no-contextual', 'no-discretionary-ligatures', 'no-historical-ligatures', 'oldstyle-nums', 'proportional-nums', 'small-caps', 'stylistic-eight', 'stylistic-eighteen', 'stylistic-eleven', 'stylistic-fifteen', 'stylistic-five', 'stylistic-four', 'stylistic-fourteen', 'stylistic-nine', 'stylistic-nineteen', 'stylistic-one', 'stylistic-seven', 'stylistic-seventeen', 'stylistic-six', 'stylistic-sixteen', 'stylistic-ten', 'stylistic-thirteen', 'stylistic-three', 'stylistic-twelve', 'stylistic-twenty', 'stylistic-two', 'tabular-nums') 数组 或 string

[]

letterSpacing​

增加或减少字符之间的间距。默认情况下没有额外的字母间距。

类型
number

lineHeight​

控制文本元素内文本行之间垂直间距的数值。它指定连续文本行基线之间的距离。

类型
number

textAlign​

指定文本对齐方式。在 Android 上,值 'justify' 仅在 Oreo (8.0) 或更高版本(API 级别 >= 26)上受支持。在较低版本的 Android 上,该值将回退到 left。

类型默认值
enum('auto', 'left', 'right', 'center', 'justify')'auto'

textAlignVertical
Android
​

如果你同时使用这两个属性,verticalAlign 将优先于 textAlignVertical,这是 verticalAlign 样式属性的别名

TypeDefault
enum('auto', 'top', 'bottom', 'center')'auto'

textDecorationColor
iOS
​

类型
color

textDecorationLine​

类型默认值
enum('none', 'underline', 'line-through', 'underline line-through')'none'

textDecorationStyle
iOS
​

类型默认值
enum('solid', 'double', 'dotted', 'dashed')'solid'

textShadowColor​

类型
color

textShadowOffset​

类型
object: {width?: number, height?: number}

textShadowRadius​

类型
number

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