Skip to main content
LogBox is a development tool that displays logs in your app during development. It replaces the older YellowBox and RedBox error screens.
LogBox is only active in development mode (__DEV__ === true). In production builds, all LogBox methods are no-ops.

Methods

install()

Installs LogBox to intercept console warnings and errors. This is automatically called when you import React Native, but you can manually call it if needed. Example:

uninstall()

Uninstalls LogBox and restores the original console methods. Example:

isInstalled()

Returns whether LogBox is currently installed. Returns:
  • true if LogBox is installed, false otherwise
Example:

ignoreLogs()

Silences any logs that match the given strings or regular expressions. Parameters:
  • patterns: Array of strings or RegExp patterns to ignore
Example:
Common Use Case:

ignoreAllLogs()

Toggles error and warning notifications. Note: this only disables notifications; uncaught errors will still open a full-screen LogBox. Parameters:
  • value: Whether to ignore all logs (defaults to true if not provided)
Example:
Use Case - Screenshot Testing:

clearAllLogs()

Clears all logs currently displayed in LogBox. Example:

addLog()

Manually adds a log to LogBox. Generally not needed unless you’re building custom logging tools. Parameters:
  • log: Log data object containing:
    • level: 'warn' | 'error' | 'fatal'
    • message: Message object with content string
    • category: String category for grouping
    • componentStack: Stack trace array
Example:

addException()

Adds an exception to LogBox. Used internally by the error handling system. Parameters:
  • error: Extended exception data object

Common Patterns

Ignore Known Third-Party Warnings

Conditional LogBox Configuration

Clear Logs Programmatically

Project Setup Example

Development vs Production

Development (__DEV__ === true):
  • LogBox intercepts console.warn() and console.error()
  • Shows warnings and errors in an overlay
  • Allows ignoring specific messages
Production (__DEV__ === false):
  • All LogBox methods become no-ops
  • No overlays are shown
  • Console methods work normally
  • No performance impact

Best Practices

  1. Don’t Ignore Everything: Use ignoreLogs() sparingly and only for known, unavoidable warnings
  2. Use Specific Patterns: Prefer specific strings over broad regex patterns to avoid hiding important warnings
  3. Document Ignored Warnings: Add comments explaining why each warning is ignored
  4. Temporary Ignores: Review ignored warnings periodically and remove them when the underlying issues are fixed
  5. Team Communication: Keep ignored warnings in version control so the whole team is aware

Migration from YellowBox

If you’re migrating from the old YellowBox: