網(wǎng)址
RN第三方庫查詢網(wǎng)址
環(huán)境搭建
1.安裝工具
Node
python2
jdk
react native命令行工具犁柜,yarn(Yarn是 Facebook 提供的替代 npm 的工具)
#設(shè)置鏡像源
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
#下載react-native工具及yarn
npm install -g yarn react-native-cli
#設(shè)置yarn鏡像源
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
2.創(chuàng)建新項目
初始化項目
react-native init projectName
運行項目
react-native run-android
開始
生命周期
getDefaultProps
getInitialState
componentWillMount
render
componentDidMount
componentWillReceiveProps
shouldComponetUpdate
componentWillUpdate
render
componentDidUpdate
componentWillUnmount
WebStorm的React native配置
1.setting-Languages&Frameworks-JavaScript配置如圖
2.安裝react, react-native,react-DefinitelyTyped, react-native-DefinitelyTyped插件
3.配置npm