跳到主要內容

文字樣式屬性

範例

參考

屬性

color

類型
color

fontFamily

類型
字串

fontSize

類型
數字

fontStyle

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

fontWeight

指定字體粗細。值 'normal''bold' 大部分字體都支援。並非所有字體都具有每個數值變體,在這種情況下,將選擇最接近的字體。

類型預設
enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900') 或數字'normal'

includeFontPadding
Android

設定為 false 以移除額外的字體內邊距,這些內邊距旨在為某些上升部/下降部留出空間。 對於某些字體,當垂直居中時,此內邊距會使文字看起來略微錯位。 為了獲得最佳效果,也請將 textAlignVertical 設定為 center

類型預設
布林值true

fontVariant

允許您設定字體的所有變體。 可以使用枚舉陣列或空格分隔的字串來設定,例如 'small-caps common-ligatures'

類型預設
enum 陣列 ('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums') 或字串[]

letterSpacing

增加或減少字元之間的間距。 預設情況下,沒有額外的字母間距。

類型
數字

lineHeight

數值,控制文字元素內文字行之間的垂直間距。 它指定連續文字行的基線之間的距離。

類型
數字

textAlign

指定文字對齊方式。 在 Android 上,僅在 Oreo (8.0) 或更高版本(API level >= 26)上支援值 'justify'。 在較低的 Android 版本上,該值將回退為 left

類型預設
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

類型
數字

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