react-native学习笔记

1.安装  cnpm  i  expo-cli  -g

2.expo init rn-basic 创建一个新项目

3.项目启动    yarn  start

4.基本组件

View(相当于div)

Text(相当于span,p)

StyleSheet(样式)

Props

State

Style  (小驼峰,不加引号,没有单位,没有复合属性的写法)(颜色属性还是要加引号的)

Width&&Height

TextInput   (keyboardType={'numeric'}   键盘类型为数字键盘)

Handling Touches

)

5.hello world(100不要加px)

6.constructor在子类调用时,父类也会调用

如果要在子类的constructor里使用this, 必须调用父类的constructor

如果不这样做,就拿不到this

如何调用父类的constructor?   super()

如果要在constructor里使用父组件传递过来的参数,必须在调用父组件super时,传递参数给父组件的constructor

如果你不在constructor里边使用this,或是参数,就不需要super

因为react已经帮你做了this, props的绑定

7.TouchableHighlight      TouchableNativeFeedback     TouchableOpacity     TouchableWithoutFeedback

onpress  点击事件

8.Flatlist

9.Networking

原文地址:https://www.cnblogs.com/jsjx-xtfh/p/10029153.html