RN 中文API:https://reactnative.cn/docs/getting-started
搭建环境:https://reactnative.cn/docs/environment-setup
调试:https://reactnative.cn/docs/debugging
集成到现有原生:https://reactnative.cn/docs/integration-with-existing-apps
搭建环境
环境要求:Node(>=14)、JDK(>=11)、Android Studio
切换npm镜像(淘宝源)
1
2
3
4
5# 使用nrm工具切换淘宝源
npx nrm use taobao
# 如果之后需要切换回官方源可使用
npx nrm use npm配置环境变量
1
2
3
4%ANDROID_HOME%\platform-tools\
%ANDROID_HOME%\emulator\
%ANDROID_HOME%\tools\
%ANDROID_HOME%\tools\bin\
新建项目
1 | npx react-native init AwesomeProject |
运行项目
用命令行方式
1
2cd AwesomeProject
npx react-native run-android1
2
3
4cd AwesomeProject
yarn android
或
yarn react-native run-android