ReactNative中的样式属性

属性:web

numberOfLines={规定的行数}svg

文本行数限制,添加后超过限制行数文本会在末尾默认以…的形式省略。函数

ellipsizeMode
设置文本缩略格式,配合numberOfLines使用,values:布局

  • tail:在末尾…省略(默认值)
  • clip:在末尾切割,直接切割字符无省略符
  • head:在前面…省略
  • middle:在中间…省略

点击事件 (须要配合点击方法好比" ")字体

  • onPress
  • 布局中的属性均可以重写"StyleSheet"属性,

style
样式orm

accessible:
表示此视图时一个启用了无障碍功能的元素。默认为truexml

onMagicTap:
当accessible为true时,双击View会调用此函数。事件

onMoveShouldSetResponder:
触摸控件并滑动时调用的方法ip

onMoveShouldSetResponderCapture:
触摸控件并滑动时调用的方法,避免子视图响应ci

onResponderMove:
用户在View上移动手指调用

onResponderRelease
结束触摸时调用

pointerEvents:
控制当前视图是否能够触控:’box-none’, ‘none’, ‘box-only’, ‘auto’


样式:


width:宽度(若是宽度是手机屏幕的所有能够设置为"100%")

height:高度(若是高度是手机屏幕的所有能够设置为"100%")

backgroundColor:背景颜色

backfaceVisibility:是否显示翻转’visible’,’hidden’

borderColor:边框颜色

borderWidth:边框宽度

borderRadius:边框圆角半径

borderStyle:边框样式

  • solid:实线,
  • dotted:点,
  • dashed:虚线

borderTopColor:上边框颜色

borderTopWidth:上边框宽度

borderTopLeftRadius:左上角边框圆角的半径

borderTopRightRadius:右上角边框圆角的半径

overflow:内容超过容器时超出显示仍是隐藏:’visible’, ‘hidden’

opacity:透明度

color:字体颜色

fontSize:字体大小

fontFamily:字体

fontStyle: 字的样式

  • normal:正常
  • italic:斜体

fontWeight 设置粗体
normal:正常
bold:粗体
100,200,300, 400, 500, 600, 700, 800, 900)

lineHeight:行高

textAlign 文字对其方式
auto:自动对齐
left:左对齐
right:右对齐
center:居中对齐

textDecorationLine 下划线和删除线样式
none:无线
underline:下划线
line-through:删除线
underline line-through:下划线和删除线