Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find all list of style properties supported by react native?

Tags:

react-native

Where can I get a list of the style properties supported by React Native for each type of component?

like image 548
o0omycomputero0o Avatar asked Aug 18 '16 15:08

o0omycomputero0o


People also ask

How do I display list of items in React Native?

React Practice Course. We will import List in our Home component and show it on screen. To create a list, we will use the map() method. This will iterate over an array of items, and render each one. When we run the app, we will see the list of names.

What styling does React Native use?

With React Native, you style your application using JavaScript. All of the core components accept a prop named style . The style names and values usually match how CSS works on the web, except names are written using camel casing, e.g. backgroundColor rather than background-color .

Does React Native support CSS?

React Native lets you style your whole application using JavaScript. Every component can use a prop named style , which enables you to write CSS styles for those components. There are two main methods that React Native has for creating styles: inline styling and using a style prop to style subcomponents.

What is the attribute used to declare a styles in React Native?

Style attributes React Native mostly use CSS attributes with camelCase instead of kebab-case for styling.


2 Answers

Here's a cheatsheet:

  • React Native Styling Cheat Sheet

The supported styles are in the official documentation for each component. Here are the links for View and Text components:

  • View : https://reactnative.dev/docs/view#style
  • Text: https://reactnative.dev/docs/text#style

Note that where it says View Style Props... on the top of styles for Text, it means it also supports (most of) the styles that View supports.

like image 131
nabn Avatar answered Oct 17 '22 13:10

nabn


I have extracted a list of valid styles from react native logs.

Below collection help me alot during regular work.

[   "alignContent",   "alignItems",   "alignSelf",   "aspectRatio",   "backfaceVisibility",   "backgroundColor",   "borderBottomColor",   "borderBottomLeftRadius",   "borderBottomRightRadius",   "borderBottomWidth",   "borderColor",   "borderLeftColor",   "borderLeftWidth",   "borderRadius",   "borderRightColor",   "borderRightWidth",   "borderStyle",   "borderTopColor",   "borderTopLeftRadius",   "borderTopRightRadius",   "borderTopWidth",   "borderWidth",   "bottom",   "color",   "decomposedMatrix",   "direction",   "display",   "elevation",   "flex",   "flexBasis",   "flexDirection",   "flexGrow",   "flexShrink",   "flexWrap",   "fontFamily",   "fontSize",   "fontStyle",   "fontVariant",   "fontWeight",   "height",   "includeFontPadding",   "justifyContent",   "left",   "letterSpacing",   "lineHeight",   "margin",   "marginBottom",   "marginHorizontal",   "marginLeft",   "marginRight",   "marginTop",   "marginVertical",   "maxHeight",   "maxWidth",   "minHeight",   "minWidth",   "opacity",   "overflow",   "overlayColor",   "padding",   "paddingBottom",   "paddingHorizontal",   "paddingLeft",   "paddingRight",   "paddingTop",   "paddingVertical",   "position",   "resizeMode",   "right",   "rotation",   "scaleX",   "scaleY",   "shadowColor",   "shadowOffset",   "shadowOpacity",   "shadowRadius",   "textAlign",   "textAlignVertical",   "textDecorationColor",   "textDecorationLine",   "textDecorationStyle",   "textShadowColor",   "textShadowOffset",   "textShadowRadius",   "tintColor",   "top",   "transform",   "transformMatrix",   "translateX",   "translateY",   "width",   "writingDirection",   "zIndex" ] 

Implementation details are here: https://github.com/vhpoet/react-native-styling-cheat-sheet/blob/master/README.md

like image 33
Ahsanwarsi Avatar answered Oct 17 '22 13:10

Ahsanwarsi