3 Styles

1.Declare Style

1. const styles = StyleSheet.create({
2. container: {
3. flex: 1,
4. backgroundColor: 'blue',
5. },
6. text: {
7. fontSize: 14,
8. color: 'red'
9. }
10. });

2.Using Styles

1. class Main extends Component {
2. render() {
3. return (
4. <View style={styles.container}>
5. <Text style={styles.text}>I am red.</Text>
6. </View>
7. );
8. }
9. }

3.Properties

原文: <https://unbug.gitbooks.io/react-native-training/content/3_styles.html>