Skip to main content

文本样式属性

示例​

¥Example

参考

¥Reference

属性​

¥Props

color​

类型
color

fontFamily​

类型
string

iOS 支持通用字体系列 system-ui、ui-sans-serif、ui-serif、ui-monospace 和 ui-rounded。

¥The generic font families system-ui, ui-sans-serif, ui-serif, ui-monospace, and ui-rounded are supported on iOS.


fontSize​

类型
number

fontStyle​

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

fontWeight​

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

¥Specifies font weight. The values 'normal' and 'bold' are supported for most fonts. Not all fonts have a variant for each of the numeric values, in that case the closest one is chosen.

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

includeFontPadding
Android
​

设置为 false 以删除额外的字体填充,旨在为某些上升部分/下降部分腾出空间。对于某些字体,此填充可能会使文本在垂直居中时看起来稍微未对齐。为了获得最佳结果,还将 textAlignVertical 设置为 center。

¥Set to false to remove extra font padding intended to make space for certain ascenders / descenders. With some fonts, this padding can make text look slightly misaligned when centered vertically. For best results also set textAlignVertical to center.

类型默认
booltrue

fontVariant​

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

¥Allows you to set all the font variants for a font. Can be set by using an array of enums or a space-separated string e.g. 'small-caps common-ligatures'.

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

letterSpacing​

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

¥Increase or decrease the spacing between characters. By default there is no extra letter spacing.

类型
number

lineHeight​

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

¥Numeric value that controls the vertical spacing between lines of text within a text element. It specifies the distance between the baselines of consecutive lines of text.

类型
number

textAlign​

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

¥Specifies text alignment. On Android, the value 'justify' is only supported on Oreo (8.0) or above (API level >= 26). The value will fallback to left on lower Android versions.

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

textAlignVertical
Android
​

类型默认
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​

类型
目的:{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 属性。

¥It allows the user to select text and to use the native copy and paste functionality. Has precedence over the selectable prop.

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