/**
* Create by bamboo on 2018-04-13
* 页面布局
*/
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';


export default class App extends Component {
constructor(props) {
super(props);
this.state = {
};
}

render() {
return (
<View style={styles.body}>
<Text>列式布局</Text>
<View style={styles.row}>
<View style={styles.r1}></View>
<View style={styles.r2}></View>
</View>

<Text>行式布局</Text>
<View style={styles.column}>
<View style={styles.c1}></View>
<View style={styles.c2}></View>
</View>
</View>
);
}
}

const styles = StyleSheet.create({
body:{
},
row:{
flexDirection:'row',
height:50,
},
r1:{
flex:1,
backgroundColor:'#33ccff',
},
r2:{
flex:2,
backgroundColor:'#FF34B3',
},
column:{
flexDirection:'column',
height:50,
},

c1:{
flex:1,
backgroundColor:'#33ccff',
},
c2:{
flex:2,
backgroundColor:'#FF34B3',
},

});

结果如下:

react-native 列式布局 行式布局


相关文章:

  • 2021-07-01
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
猜你喜欢
  • 2021-05-22
  • 2021-10-20
  • 2022-12-23
  • 2021-10-13
  • 2021-09-13
  • 2021-04-27
  • 2021-12-01
相关资源
相似解决方案