Skip to the workspace
Pebellslearn by building
Development Workflow  ›  Lesson

LogBox, DevTools and Source Maps

LogBox 12 minLogBox shows warnings in yellow and errors in red on the device, React Native DevTools lets you inspect and set breakpoints, and source maps point both back to your original files.

react native / LogBox, DevTools and Source Maps

Explore each scene at your own pace.

01 · The rule

The rule

LogBox, DevTools and Source Maps

Sprout crashes when you open a plant with no photo. The screen turns red, a stack trace appears, and you need to find the exact line. React Native gives you three tools for this: LogBox on the phone, DevTools on your computer, and source maps connecting both to your real files.

The rule

Yellow warns, red stops; DevTools digs; source maps point home.

LogBox is the in-app error and warning display, active only in development.

  • console.warn(...) shows a yellow notice at the bottom of the screen.
  • console.error(...) shows a red notice at the bottom.
  • An unhandled error during rendering, or a syntax error, fills the whole screen in red.

Tap a notice to see the full message and a stack trace. To silence a known, harmless warning from a library, list part of its text:

import { LogBox } from 'react-native';

LogBox.ignoreLogs(['Some library warning text']);

Ignore sparingly. A hidden warning is still happening.

DevTools is the debugging window on your computer. In current React Native it is React Native DevTools, which you open by pressing j in the Expo terminal or choosing it from the developer menu. It has a Console for logs, Sources for breakpoints and stepping through code, and React's Components and Profiler panels to inspect props, state and slow renders.

Source maps connect the bundle back to your files. Metro combines everything into one large bundle, so without a map an error would point to "line 48,210 of the bundle". The source map translates that into components/PlantCard.js, line 12. Metro creates them automatically in development. For release builds, you upload them to your crash-reporting service so production stack traces stay readable too.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.