Skip to main content
Debugging React Native applications requires a combination of tools and techniques for both JavaScript and native code. This guide covers the essential debugging tools available to React Native developers.

Developer Menu

The Developer Menu provides quick access to debugging tools and can be accessed by:
  • iOS Simulator: Cmd + D
  • Android Emulator: Cmd/Ctrl + M
  • Physical Device: Shake gesture

Available Options

The Developer Menu includes:
  • Reload: Reload the JavaScript bundle
  • Debug with Chrome: Opens Chrome DevTools for debugging
  • Toggle Inspector: Inspect element hierarchies and styles
  • Show Performance Monitor: Display memory and performance metrics
  • Fast Refresh: Enable/disable automatic refresh on file changes

LogBox

LogBox is React Native’s built-in error and warning management system. It provides a better developer experience by:
  • Displaying errors with syntax highlighting and stack traces
  • Collapsing framework-internal logs for clarity
  • Providing actionable error messages
  • Allowing log filtering and dismissal

Using LogBox

import {LogBox} from 'react-native';

// Ignore specific warnings
LogBox.ignoreLogs([
  'Warning: componentWillReceiveProps',
]);

// Ignore all logs (not recommended for production)
LogBox.ignoreAllLogs(true);
Never use LogBox.ignoreAllLogs() in production. It’s only meant for presentations or demos.

React DevTools

React DevTools allows you to inspect the React component hierarchy, props, and state.

Installation

npm install -g react-devtools

Usage

react-devtools
Then reload your app to connect. React DevTools will automatically detect your React Native application.

Chrome DevTools

When using the “Debug with Chrome” option, you can access:
  • Console: View console.log output and errors
  • Sources: Set breakpoints and step through code
  • Network: Inspect network requests (limited in React Native)
  • Performance: Profile JavaScript execution

Debugging JavaScript

// Set a breakpoint in your code
debugger;

// Or use console methods
console.log('Value:', value);
console.warn('Warning message');
console.error('Error:', error);

Native Debugging

iOS

Use Xcode to debug native iOS code:
  1. Open ios/YourApp.xcworkspace in Xcode
  2. Set breakpoints in Objective-C or Swift files
  3. Run the app from Xcode (Cmd + R)
  4. Use the debugger when breakpoints are hit

Android

Use Android Studio to debug native Android code:
  1. Open the android folder in Android Studio
  2. Set breakpoints in Java or Kotlin files
  3. Run the app in debug mode
  4. Attach the debugger to the process

Performance Monitoring

DevSettings Module

Customize developer settings programmatically:
import DevSettings from 'react-native/Libraries/Utilities/DevSettings';

// Add custom dev menu items
DevSettings.addMenuItem('Show Secret Menu', () => {
  // Custom action
});

// Reload the app
DevSettings.reload();

Network Debugging

Using Flipper

Flipper provides network inspection capabilities:
  1. Install Flipper desktop app
  2. Enable the Network plugin
  3. View all network requests with headers, bodies, and timing

Manual Network Logging

const originalFetch = fetch;
global.fetch = async (...args) => {
  console.log('Fetch:', args[0]);
  const response = await originalFetch(...args);
  console.log('Response:', response.status);
  return response;
};

Source Maps

React Native automatically generates source maps for debugging. The Metro bundler includes source map support that allows you to:
  • See original file names and line numbers in stack traces
  • Set breakpoints in your original source code
  • Step through code that matches your source files

Symbolicating Stack Traces

For production crashes, symbolicate stack traces:
npx metro-symbolicate android/app/build/generated/sourcemaps/react/release/index.android.bundle.map < stacktrace.txt

Common Debugging Scenarios

Red Screen Errors

Red screens indicate fatal errors:
  1. Read the error message carefully
  2. Check the stack trace for the error source
  3. Look for file names and line numbers
  4. Click on stack frames to open in editor

Yellow Box Warnings

Yellow warnings (now shown in LogBox) should not be ignored. They often indicate potential issues that can cause problems in production.
Address warnings by:
  • Updating deprecated APIs
  • Fixing incorrect prop types
  • Resolving performance issues

Remote Debugging Caveats

Remote debugging runs JavaScript in Chrome’s V8 engine, not JSC or Hermes. This can cause timing differences and hide some bugs.
  • Performance is slower when remote debugging
  • Some native modules may behave differently
  • Async operations may have different timing

Best Practices

  1. Use TypeScript: Catch errors at compile time
  2. Enable Fast Refresh: See changes instantly
  3. Use console methods wisely: Leverage console.group, console.table
  4. Set up error boundaries: Catch React errors gracefully
  5. Test on real devices: Simulators don’t catch all issues
  6. Use Flipper: Comprehensive debugging for both platforms
  7. Keep DevTools open: Monitor logs and network in real-time

Next Steps

Metro Bundler

Configure Metro for optimal development

Testing

Set up testing for your application

Build docs developers (and LLMs) love