Debug React Native Source Code with Breakpoints

 

  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
  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.
Advertisements

React Native – “Unable to resolve module”

Do the following steps to cleanup

  • Quit and launch Terminal
  • rm -rf iOS/build
  • npm cache verify
  • watchman watch-del-all
  • rm -rf node_modules
  • rm -rf /tmp/metro-bundler-cache-*
  • rm -rf /tmp/haste-map-react-native-packager-*
  • rm -rf $TMPDIR/react-*
  • rm -rf $TMPDIR/haste-*
  • rm -rf $TMPDIR/metro-*
  • npm cache clean
  • npm install && react-native link && react-native run-ios