ReactNative 属性

来源:互联网 发布:合成视频的软件 编辑:程序博客网 时间:2024/05/16 12:20

ReactNative中的属性用法。

import React, {Component} from 'react';import {    AppRegistry,    StyleSheet,    Text,    View,    TouchableOpacity,    TextInput,    Image,} from 'react-native';/** * 2、flex 属性 */let RnDemo = React.createClass({    render: function () {        return (            <View style={styles.container}>                <View style={styles.child1}></View>                <View style={styles.child2}></View>            </View>        );    }});//创建样式let styles = StyleSheet.create({    container: {        margin: 30,        width: 300,        height: 500,        backgroundColor: "yellow",        //默认主抽方向 column        //设置为横向        flexDirection: "row",        //设置主抽方法居中        justifyContent: "center",        //交叉抽        // alignItems: "center",    },    child1: {        width: 100,        height: 100,        backgroundColor: "green",    },    child2: {        width: 100,        height: 100,        backgroundColor: "blue",    }});


原创粉丝点击