跳到主要内容

文本样式属性

示例

参考

属性

color

类型
颜色

fontFamily

类型
字符串

fontSize

类型
数字

fontStyle

类型
枚举('normal', 'italic')

fontWeight

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

类型默认
枚举('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900') 或 数字'normal'

includeFontPadding
Android

设置为false可移除旨在为某些上升/下降笔画留出空间的额外字体内边距。对于某些字体,此内边距在垂直居中时可能导致文本看起来略微错位。为获得最佳效果,请同时将textAlignVertical设置为center

类型默认
布尔值true

fontVariant

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

类型默认
枚举数组('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums') 或 字符串[]

letterSpacing

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

类型
数字

lineHeight

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

类型
数字

textAlign

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

类型默认
枚举('auto', 'left', 'right', 'center', 'justify')'auto'

textAlignVertical
Android

类型默认
枚举('auto', 'top', 'bottom', 'center')'auto'

textDecorationColor
iOS

类型
颜色

textDecorationLine

类型默认
枚举('none', 'underline', 'line-through', 'underline line-through')'none'

textDecorationStyle
iOS

类型默认
枚举('solid', 'double', 'dotted', 'dashed')'solid'

textShadowColor

类型
颜色

textShadowOffset

类型
对象: {width?: number, height?: number}

textShadowRadius

类型
数字

textTransform

类型默认
枚举('none', 'uppercase', 'lowercase', 'capitalize')'none'

verticalAlign
Android

类型默认
枚举('auto', 'top', 'bottom', 'middle')'auto'

writingDirection
iOS

类型默认
枚举('auto', 'ltr', 'rtl')'auto'

userSelect

它允许用户选择文本并使用原生复制和粘贴功能。优先于selectable属性。

类型默认
枚举('auto', 'text', 'none', 'contain', 'all')