React-Native 基础(六) 使用Flexbox布局
参考文档:http://facebook.github.io/react-native/docs/flexbox.html flexDirection import React,{ Component } from 'react'; import { AppRegistry,View } from 'react-native'; class FlexDirectionBasics extends Component { render() { return ( // Try setting `flexDirection` to `column`. <View style={{flex: 1,flexDirection: 'row'}}> <View style={{width: 50,height: 50,backgroundColor: 'powderblue'}} /> <View style={{width: 50,backgroundColor: 'skyblue'}} /> <View style={{width: 50,backgroundColor: 'steelblue'}} /> </View> ); } }; AppRegistry.registerComponent('AwesomeProject',() => FlexDirectionBasics);
justifyContent import React,View } from 'react-native'; class JustifyContentBasics extends Component { render() { return ( // Try setting `justifyContent` to `center`. // Try setting `flexDirection` to `row`. <View style={{ flex: 1,flexDirection: 'column',justifyContent: 'space-between',}}> <View style={{width: 50,() => JustifyContentBasics);
alignItems 更多的布局参见 http://facebook.github.io/react-native/docs/layout-props.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |