这些就建立在搭建好ReactNative环境之后进行开发的。
样式:
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
TextInput,
Image,
} from 'react-native';
//控件的引用 此处使用的是 ES6的新特性
import MyNavigatorPassValue from "./views/MyNavigatorPassValue"
/**1、样式
*
*/
let RnDemo = React.createClass({
render: function () {
return (
<View style={styles.container}>
<View style={[styles.top, styles.border]}></View>
<View style={[styles.bottom, styles.border, {borderWidth: 5}]}></View>
</View>
);
}
});
/*
定义样式 区别 样式组合时 越往后优先级越高
*/
let styles = StyleSheet.create({
//外层view
container: {
marginTop: 25,
marginLeft: 30,
backgroundColor: "red",
width: 300,
height: 400,
},
//上层view
top: {
backgroundColor: "green",
width: 280,
height: 250,
margin: 10,
},
//下层view
bottom: {
backgroundColor: "yellow",
width: 280,
height: 110,
margin: 10,
},
border: {
borderWidth: 3,
borderColor: "black",
}
});