react native 0.60版本react依赖是16.8.6,可以使用hooks等一些新特性。
1.执行react-native init demo,遇到如下错误,查看了本地node版本为8.5,执行sudo n stable升级node至最新稳定版本,sudo npm install npm@latest -g升级至最新的npm



2.中途会提示你安装cocoaPods以便管理ios依赖,可以理解为ios的npm包管理工具,详见cocoapods官网
CocoaPods是Swift和Objective-C Cocoa项目的依赖管理器。
CocoaPods是使用Ruby构建的,可以使用macOS上的默认Ruby进行安装。
sudo gem install cocoapods


3.安装 Installing required CocoaPods dependencies耗时很久,大约20分钟(首次耗时较久,20-40min需耐心等候)


4.react-native run-ios

5.react-native run-android
执行run-android时自动更新了gradle以适配androidX,可以使用react-native run-android --no-jetifier

6.在android目录下添加local.properties文件,配上sdk.dir = /Users/huajian/Library/Android/sdk (本地SDK路径)



网友评论