Skip to content

Latest commit

 

History

History
61 lines (49 loc) · 2.92 KB

File metadata and controls

61 lines (49 loc) · 2.92 KB

Chapter 4 - Styling and Layout

Styling

  • We just use JavaScript objects
  • Names written camelCased (backgroundColor instead of background-color)
  • You could use a normal object but use StyleSheet.create
  • You can have mulitple objects in the array of styles <Text style={[styles.bigblue, styles.red]}>Some text</Text>
  • Limited inheritance for <Text />
// the text with "highlight" will have both the styles from text and highlight
<Text style={styles.text}>Some text <Text style={styles.highlight} > that needs highlighting.</Text> </Text>

Layout

  • Use Flexbox for layout
  • flexDirection, alignItems, and justifyContent

Resources

Exercises

Here is a wee exercise :-) How many can you do?

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout

layout