1、基于flex布局,默认是纵向排列
flex-direction: column;
2、width,height等设置不需要单位(px,vw,vh...),可以采用百分比
3、样式不继承,例如:子元素不会父元素的fontSize
4、View标签不能单独存放文本
5、Imgae标签引用的外部资源图片,必须要设置width,height属性
6、transform写法,以数组的形式
// 向下移动100,放大 2 倍
style={
{transform: [{translateY: 100},{scale: 2}]}}
7、引用react-native的Dimensions方法可以获取设备宽高
import {Dimensions} from 'react-native'
// math.round()是 Javascript中的一个内置函数,它的作用是对一个数字进行四舍五入取整
const screenWidth = Math.round(Dimensions.get('width').width)
const screenHeight = Math.round(Dimensions.get('height').height)
8、mobx 全局数据管理库
9、mobx-react: 方便在react中使用mobx
// mobx.js
import {observable, action} from 'mobx';
class RootStore {
// es7装饰器语法 Object.defineProerty