React Native 样式(1)

2017-10-30  本文已影响41人  Hither
import React ,{Component} from 'react';
import {AppRegistry, StyleSheet, Text, View} from 'react-native';

export default class LotsOfStyles extends Component {
  render(){
    return(
    <View style={styles.container}>
      <Text style={styles.red}>just red</Text>
      <Text style={styles.bigblue}>just bigblue</Text>
        /*数组赋值属性,使用最后一个值*/
      <Text style={[styles.bigblue,styles.red]}>bigblue,thne red</Text>
      <Text style={[styles.red,styles.bigblue]}>red , then bigblue</Text>
    </View>
    );
  }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    bigblue:{
        color: 'blue',
        fontWeight:'bold',
        fontSize:30,
   } ,
    red:{
        color:'red',
    },
});
上一篇下一篇

猜你喜欢

热点阅读