第一个demo:
效果图:
index.android.js:
'use strict';
import React,{Component} from 'react';
import {AppRegistry,View} from 'react-native';
class FixedDimensionsBasics extends Component{
render(){
return(
<View>
<View style={{width:50,height: 50,backgroundColor: 'powderblue'}}></View>
<View style={{width: 100,height: 100,backgroundColor: 'skyblue'}}></View>
<View style={{width: 150,height: 150,backgroundColor: 'steelblue'}}></View>
</View>
);
}
}
//MyFirstProject 必须初始化的项目名字
AppRegistry.registerComponent('MyFirstProject',() => FixedDimensionsBasics);
效果图:
index.android.js:
'use strict';
import React,{Component} from 'react';
import {AppRegistry,View} from 'react-native';
class FixedDimensionsBasics extends Component{
render(){
return(
<View style={{flex:1}}>
<View style={{flex: 1,backgroundColor: 'powderblue'}}></View>
<View style={{flex: 2,backgroundColor: 'skyblue'}}></View>
<View style={{flex:3,backgroundColor: 'steelblue'}}></View>
</View>
);
}
}
//MyFirstProject 必须初始化的项目名字
AppRegistry.registerComponent('MyFirstProject',() => FixedDimensionsBasics);