在使用React Navigation之前需要安装,依次运行以下命令:
- 运行
yarn add react-navigation
或cnpm install --save react-navigation
- 运行
yarn add react-native-gesture-handler
或cnpm install --save react-native-gesture-handler
- 运行
react-native link react-native-gesture-handler
注:
如果使用yarn
命令需要安装yarn
cnpm install -g yarn react-native-cli
设置镜像源
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
安装完 yarn 之后就可以用 yarn 代替 npm 了,例如用yarn代替npm install命令,用yarn add 某第三方库名代替npm install 某第三方库名