react-devtool+chorme-debugger
调试页面 http://localhost:8081/debugger-ui
通过 chrome://inspect/#devices 添加Devices,并且调试对应的console
注意:
● Chrome 中并不能直接看到 App 的用户界面,而只能提供 console 的输出,以及在 sources 项中断点调试 js 脚本。
● 使用 Chrome 调试目前无法观测到 React Native 中的网络请求,可以使用功能更强大的第三方的react-native-debugger或是官方的flipper(注意仅能在 0.62 以上版本可用)来观测。
Fipper
- 下载安装Flipper
1.官网下载
2.homebrew安装brew install --cask flipper
- Mac电脑“无法验证开发者”
-
使用 Flipper - Expo 中文网 (nodejs.cn)
Node & Watchman
推荐使用Homebrew来安装 Node 和 Watchman。在命令行中执行下列命令安装(如安装较慢可以尝试阿里云的镜像源):
# watchman在搭建安卓开发环境的时候会装好。adb在安装android studio 时就会默认安装了
brew install node@16
brew install watchman
IDB installed
最好检查一下现在系统有没有安装好idb(搁这卡了半天)
有的话会返回路径
user@userMacBook-Pro ~ % which idb
/opt/homebrew/bin/idb
在flipper设置中把上面的路径配置进去
[react-native] 使用flipper打造一个完美的debug环境 - 掘金 (juejin.cn)