1. 进入工程目录,启动:Metro
npx react-native start
2. 然后在新的terminal窗口中运行app
npx react-native run-ios
第1,2步参考:https://reactnative.dev/docs/environment-setup#running-your-react-native-application
这时你的程序应该运行起来了。每次操作可以在显示Metro的窗口看到日志,包括console.log打印的结果。
3. 此时,可以在IOS Simulator窗口打开developer menu,打开方式有几种:
a) Press Cmd-D on the keyboard. (对我不起作用)
b) Press Cmd-Ctrl-Z on the keyboard.
c) 在Simulator菜单 > Device > Shake (快捷键Cmd-Ctrl-Z)
4. Debugging JS on Hermes using Google Chrome's DevTools
See: https://reactnative.dev/docs/hermes#debugging-js-on-hermes-using-google-chromes-devtools
a) Navigate to chrome://inspect in a Chrome browser instance.
b) Use the Configure... button to add the Metro server address (typically localhost:8081 as described above).
TODO: 如何远程Debug,我还没实践,参考:https://reactnative.dev/docs/debugging
标签:docs,App,Cmd,dev,React,native,https,reactnative,Native From: https://www.cnblogs.com/saaspeter/p/17460242.html