美文网首页
React Native 常用组件之 Text

React Native 常用组件之 Text

作者: 厉害了我的國 | 来源:发表于2016-12-15 22:29 被阅读0次

一、什么是Text组件?

一个用于显示文本的React组件,和Android中的TextView组件或者OC中的Label组件相类似,专门用来显示基本的文本信息;除了基本的显示布局之外,可以进行嵌套显示,设置样式,以及可以做事件(例如:点击)处理;

二、Text组件属性

  • color (string):字体颜色;
  • fontSize (number):字体大小;
  • fontFamily (string):字体名称;
  • fontStyle (enum):字体风格 enum("normal",'italic');
  • fontWeight (enum):字体粗细 enum("normal", 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
  • numberOfLines (number):显示文本的行数,如果显示的内容超过了行数,默认其他多余的信息就不会显示了;
  • letterSpacing ():字符间距;
  • lineHeight (number):行高;
  • textAlign (string):文本对其方式("auto", 'left', 'right', 'center', 'justify')
  • textDecorationLine (string):横线位置 ("none", 'underline', 'line-through', 'underline line-through')
  • textDecorationStyle (string):横线风格 ("solid", 'double', 'dotted', 'dashed')
  • textDecorationColor (string):横线颜色;
  • writingDirection (string):文本方向 ("auto", 'ltr', 'rtl')
  • textShadowOffset (string):设置阴影效果 {width:number,height:number}
  • textShadowRadius (number):阴影效果圆角;
  • textShadowColor (string):阴影效果颜色;
  • onPress (function):该方法是当文本发生点击的时候调用;

相关文章

网友评论

      本文标题:React Native 常用组件之 Text

      本文链接:https://www.haomeiwen.com/subject/smigmttx.html