美文网首页
React Native 样式(1)

React Native 样式(1)

作者: Hither | 来源:发表于2017-10-30 10:03 被阅读41次
    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',
        },
    });
    

    相关文章

      网友评论

          本文标题:React Native 样式(1)

          本文链接:https://www.haomeiwen.com/subject/twcppxtx.html