Style attributes in ReactNative

Attributes:

numberOfLines={prescribed number of lines}

The number of text lines is limited. After adding, the text that exceeds the limit will be omitted in the form of... by default at the end.

ellipsizeMode
sets the text abbreviation format, used with numberOfLines, values:

  • tail: at the end... omitted (default)
  • clip: cut at the end, cut the characters directly without ellipsis
  • head: in front...omitted
  • middle: in the middle... omitted

Click event (need to cooperate with click method such as "")

  • onPress
  • The attributes in the layout can be overridden by the "StyleSheet" attribute,

style
style

accessible:
Indicates that this view is an element with accessibility features enabled. The default is true

onMagicTap:
When accessible is true, double-clicking the View will call this function.

onMoveShouldSetResponder:
The method called when the control is touched and swiped

onMoveShouldSetResponderCapture:
The method called when the control is touched and swiped to avoid sub-view response

onResponderMove: Called when the
user moves his finger on the View

onResponderRelease :
called when the touch is over

pointerEvents:
Control whether the current view can be touched: 'box-none','none','box-only','auto'


style:


width : width (if the width is all of the phone screen, it can be set to "100%")

height : height (if the height is all of the phone screen, it can be set to "100%")

backgroundColor : background color

backfaceVisibility : Whether to display flip'visible','hidden'

borderColor : border color

borderWidth : border width

borderRadius : the corner radius of the border

borderStyle : border style

  • solid : solid line,
  • dotted : dot,
  • dashed : dashed line

borderTopColor : the color of the top border

borderTopWidth : the width of the top border

borderTopLeftRadius : the radius of the rounded corner of the upper left corner

borderTopRightRadius : the radius of the rounded corner of the upper right corner

overflow : When the content exceeds the container, it is beyond display or hidden:'visible','hidden'

opacity : transparency

color : font color

fontSize : font size

fontFamily : font

fontStyle : font style

  • normal: normal
  • italic: italic

fontWeight set bold
normal : normal
bold : bold
100, 200, 300, 400, 500, 600, 700, 800, 900)

lineHeight : line height

textAlign text alignment
auto : automatic alignment
left : left alignment
right : right alignment
center : center alignment

textDecorationLine underline and strikethrough style
none : wireless
underline : underline
line-through : strikethrough
underline line-through : underline and strikethrough

Guess you like

Origin blog.csdn.net/weixin_45361581/article/details/109647255