How to Debug React Native

How to debug with breakpoints in React Native

  1. Install React Native Debugger tool

    • brew update && brew cask install react-native-debugger
    • brew cask reinstall react-native-debugger
  2. Quit Google Chrome if it already running.
  3. Launch the React Native Debugger app from Applications folder.
  4. Activate iOS simulator and Run command+d using keyboard. In the debug menu select “Debug JS Remotely” option.
  5. Go to React Native Debugger. Select ‘Toggle Developer Tools’ sub menu item from ‘View’ menu.
  6. Select Sources tab (in the React Native Debugger window).
  7. In the left side menu, expand RNDebuggerWorker.js and expand sub option localhost:****. You will see the project root folder.
  8. Select a .js file and add break point. Break point will get activated when the respective line is executed.
  9. You can see the console logs in the console area at the bottom.

How do I debug React Native native module in android studio?

Finally I found a way:

  1. Start process like normal
  2. In android studio, press the button to attach debugger to a running app.

And that's it!

See: https://developer.android.com/studio/debug/index.html#attach-debugger to know which button I meant.

Why does React Native app crash when clicking on debug in Android emulator?

I have faced same issue and it was due to the 'react-native-reanimated' package (It's mentioned in their documentation that remote debugging is no longer possible for react-native-reanimated : React Native Reanimated Known problems and limitations) and the solution is to use flipper to debug : Debugging React Native apps with Flipper



Related Topics



Leave a reply



Submit