1. 全局安裝 yarn global add create-react-native-app
2.create-react-native-app cookbooks 創建一個項目
3.yarn add typescript tslink -D
yarn add @types/react @types/react-native @types/react-dom -D
4.yarn add concurrently rimraf -D
5.yarn add react-native-scripts
6.運行項目 yarn run buildAndStart
7.tsc --init 初始化
8.如果要引入ts,文件名後綴最好用tsx
9.安裝Tabbar yarn add react-native-tab-navigator
10.yarn remove react react-native 卸載
11.泛型(給一個對象定義一個類型,這個對象的類型不確定)
12.react-native開發中引入圖片需要用到require引入
13.Image爲圖片組件
通過source去找源
resizeMode 控制圖片在view中的平鋪方式
14.fontSize只能用於text
15.ScrollView 可以讓內容滾動起來
16.yarn add lodash
sampleSize 從一個集合中取數據(第一個參數爲將要進行操作的數組,第二個參數爲取的元素個數)
17.輪播圖組件:react-native-swiper
思考:在用到swiper時,圖片已經開始滾動了,而控制器卻沒有滾動,這是怎麼回事?
解決辦法:
18.yarn add mobx
19.yarn add mobx-redux
20.路由 yarn add [email protected]
21.yarn add @types/[email protected] 增加對ts支持的包
22.touchableOpacity onpress 用來實現點擊事件
23.