StyleSheet.create(StyleObject)
and be stored in a variable for shorter inline access by using a selector name for it similar to a class in CSS.
<Component style={styleFromStyleSheet} />
<Component style={styleObject} />
<Component style={[style1,style2]} />
Most React Native styles are their CSS forms, but in camel case. So, text-decoration
becomes textDecoration
.
Unlike in CSS, styles do not get inherited. If you want child components to inherit a certain style, you must explicitly provide it to the child. This means that you cannot set a font family for an entire View
.
The one exception to this is the Text
component: nested Text
s inherit their parent styles.