React Native 初始化项目和模拟器运行

中文官方文档:https://reactnative.cn/docs/environment-setup

英文官方文档:https://reactnative.dev/docs/getting-started-without-a-framework#step-1-creating-a-new-application

创建新项目

1、初始化

bash 复制代码
# 如果你之前全局安装过旧的react-native-cli命令行工具,请使用npm uninstall -g react-native-cli卸载掉它以避免一些冲突
npm uninstall -g react-native-cli @react-native-community/cli

# 初始化
npx @react-native-community/cli init demo

# [可选参数] 指定版本或项目模板
npx @react-native-community/cli init demo --version X.XX.X

npx命令安装了npm就可以用

2、安装js依赖

进入demo

bash 复制代码
npm i
运行

1、用Android studiod打开demo的android文件夹并build, 经过漫长...漫长...漫长的时间:

2、安装手机模拟器

安装好后,点三角形按钮:

检查时候有设备的命令:

bash 复制代码
adb devices

3、运行

bash 复制代码
npm run android

运行成功:

相关推荐
前端小D11 天前
React Native项目开发(iOS侧为例)
javascript·react native·react.js
大龄秃头程序员12 天前
从源码里看懂 React Native 新架构:TurboModule 与 Fabric 到底是怎么跑起来的?
react native
前端小D13 天前
React Native Android 项目搭建
android·react native·react.js
hhhjhl15 天前
React Native 三方库「react-native-sha256」的鸿蒙化适配指南
react native·华为·harmonyos
2601_9499706915 天前
React Native 三方库「react-native-version-check」的鸿蒙化适配指南
react native·华为·harmonyos
hhhjhl15 天前
React Native 三方库「react-native-proximity」的鸿蒙化适配指南
react native·华为·harmonyos
2601_9499706915 天前
React Native 三方库「react-native-media-notification」的鸿蒙化适配指南
react native·华为·harmonyos
GitCode官方15 天前
从大语言模型到具身智能:百度百舸 LoongForge 入驻 AtomGit
人工智能·react native·百度·harmonyos·atomgit
2501_9159184118 天前
Windows 上开发 React Native iOS,真机调试、Fast Refresh 与打包 ipa
windows·vscode·react native·ios·个人开发·swift·敏捷流程
2501_9481226319 天前
Qs 跨端三方库仓颉适配全流程
python·react native·django·tornado