/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, {Component} from ‘react’;
import {
AppRegistry,//註冊
StyleSheet,//樣式
Text,//文本組件
View,//視圖組件
Image//圖片組件
} from ‘react-native’;
//引入像素點庫
var Dimension = require(‘Dimensions’);
export default class Test3 extends Component {
render() {
return (
<View style={style3.container}>
{/*flex 把父視圖平均分爲6份 各佔自己設置的x份*/}
<Text style={
{backgroundColor:'red',
height:60,
flex:1,
alignSelf:'flex-end',
marginLeft:20
}}>中國1</Text>
<Text style={{backgroundColor:'green', height:70,flex:2}}>中國2 </Text >
<Text style={{backgroundColor:'yellow',height:80,flex:2}}>中國3</Text>
<Text style={{backgroundColor:'blue', height:90,flex:1}}>中國4</Text >
</View>
);
}
}
const style3 = StyleSheet.create({
container: {
//上間距
marginTop:50,
//主軸
flexDirection:’row’,
//主軸對齊方式
justifyContent:’center’,
},
});
//註冊Demo 輸出到ios應用
AppRegistry.registerComponent(‘HelloWorld’, () => Test3);