Text
嵌套文本主件可以继承fontFamily样式.
在IOS端文本主件可以嵌套容器
Props
- selectable 决定用户是否可以长按选择文本,以便复制和粘贴。false
- numberOfLines 用来当文本过长的时候裁剪文本。包括折叠产生的换行在内,总的行数不会超过这个属性的限制。
此属性一般和ellipsizeMode搭配使用。 Number
- onLayout 在加载时或者布局变化以后调用,参数为如下的内容:Function
- onLongPress 当文本被长按以后调用此回调函数。Function
- onPress 当文本被点击以后调用此回调函数。Function
- allowFontScaling 控制字体是否要根据系统的“字体大小”辅助选项来进行缩放。默认值为true
- selectionColor 文本选中的颜色
style
textShadowOffset: object: {width: number,height: number}
color: color
fontSize: number
fontStyle: enum('normal', 'italic')
fontWeight: enum('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
指定字体的粗细。大多数字体都支持'normal'和'bold'值。并非所有字体都支持所有的数字值。如果某个值不支持,则会自动选择最接近的值。
lineHeight: number
textAlign: enum('auto', 'left', 'right', 'center', 'justify')
指定文本的对齐方式。其中'justify'值仅iOS支持,在Android上会变为left。
textDecorationLine: enum('none', 'underline', 'line-through', 'underline line-through')
textShadowColor: color
fontFamily: string
textShadowRadius: number
includeFontPadding: bool (Android)
Android在默认情况下会为文字额外保留一些padding,以便留出空间摆放上标或是下标的文字。对于某些字体来说,这些额外的padding可能会导致文字难以垂直居中。如果你把textAlignVertical设置为center之后,文字看起来依然不在正中间,那么可以尝试将本属性设置为false。默认值为true。
textAlignVertical: enum('auto', 'top', 'bottom', 'center') (Android)
fontVariant: array of enum('small-caps', 'oldstyle-nums', 'lining-nums', 'tabular-nums', 'proportional-nums') (iOS)
letterSpacing: number
Increase or decrease the spacing between characters. The default is 0, for no extra letter spacing.
iOS: The additional space will be rendered after each glyph.
Android: Only supported since Android 5.0 - older versions will ignore this attribute. Please note that additional space will be added around the glyphs (half on each side), which differs from the iOS rendering. It is possible to emulate the iOS rendering by using layout attributes, e.g. negative margins, as appropriate for your situation.
textDecorationColor: color (iOS)
textDecorationStyle: enum('solid', 'double', 'dotted', 'dashed') (iOS)
textTransform: enum('none', 'uppercase', 'lowercase', 'capitalize')
writingDirection: enum('auto', 'ltr', 'rtl') (iOS)
评论 (0)