How do you debug React Native?

后端 未结 30 2540
无人共我
无人共我 2020-11-27 10:19

How does one debug their React code with React Native while the app is running in app simulator?

相关标签:
30条回答
  • 2020-11-27 10:44

    In addition to the other answers. You can debug react-native using the debugger statement

    example:

    debugger; //breaks execution
    

    Your chrome dev tools must be open for this to work

    0 讨论(0)
  • 2020-11-27 10:44
    adb logcat *:S ReactNative:V ReactNativeJS:V
    

    run this in terminal for android log.

    0 讨论(0)
  • 2020-11-27 10:44

    Assuming you want to show this menu on Android emulator

    • Then, try ⌘+m to pop up this dev settings dialog on Android emulator on a Mac.

    • If it doesn't show then go to AVD > (click the pen to edit your emulator configuration) > advanced settings > check the enable keyboard input box.

    • And then retry ⌘+m.

    • If it doesn't show still then go to the running emulator settings and on the Send keyboard shortcuts to combobox/dropdown then select the Emulator controls (default) option.

    • And then retry ⌘+m.

    • I hope this helps, it worked for me.

    0 讨论(0)
  • 2020-11-27 10:45

    For android app .Press Ctrl+M select debug js remotely it will open a new window in chrome with url http://localhost:8081/debugger-ui. You can now debug the app in chrome browser

    0 讨论(0)
  • 2020-11-27 10:46

    if you want to debug using android device on Windows just open a command prompt then type ( make sure your adb working properly)

    adb shell input keyevent 82
    

    it will prompt a screen like the image

    then select

    debug JS Remotely
    

    it will automatically open a new window.then open inspect element or press F12 for console.

    0 讨论(0)
  • 2020-11-27 10:47

    React Native 0.62 Released - The Official solution is Flipper

    0 讨论(0)
提交回复
热议问题