Skip to content
English

Debugger

The Debugger panel lets you set breakpoints in your app’s own source files, step through the code when it pauses, read the call stack and the variables in each frame, and evaluate expressions against a paused frame.

Setting up Debugger in the SDK

The Debugger panel paused on a breakpoint in a network request handler, with the call stack and local scope open

The Debugger needs React Native 0.83 or later.

The panel has three columns: Sources on the left, the open file with the expression box under it in the middle, and Call stack, Scope and Breakpoints on the right. Drag the edges between them to resize them; the sizes are saved between sessions.

Sources lists your app’s original files, taken from the bundle’s source maps, as a folder tree under your project root. Folders inside node_modules start closed. Files appear once the app has loaded its bundle.

Type in Filter files… to swap the tree for a flat list of the files whose path contains the text, ignoring case.

Files changed by Fast Refresh are picked up on their own. If a change doesn’t show, use Refresh sources.

Press Cmd+F (Ctrl+F on Windows and Linux) to search the open file. Files are read-only.

Click a line number to add a breakpoint, and click it again to remove it. On a line with no code, the breakpoint moves down to the next line that has some. A red dot marks the files, and closed folders, that hold breakpoints, with a count when there is more than one.

Breakpoints lists every breakpoint as file:line. Click one to open its line, or use Remove breakpoint on the row. A dimmed dot means the breakpoint isn’t bound to the app yet, for example while a reloaded bundle loads.

Breakpoints stay set when the app reloads.

The app pauses when it reaches a breakpoint, showing Paused on breakpoint in the toolbar. Click Pause to stop at the next JavaScript the app runs instead, such as on your next tap. Each time it pauses, the panel opens the file at the paused line and highlights it.

While paused, use Resume, Step over, Step into and Step out. After a step the toolbar shows Paused. Your app’s JavaScript is frozen until you resume, so the app won’t respond to taps.

Call stack lists each frame’s function and file:line. Frames without source show native. Click a frame to open its line and show its variables in Scope.

Scope has a section for each scope of the selected frame, such as Local, Closure and Global. Global starts closed.

While paused, type an expression in the box under the source and press Enter. It runs in the frame selected in Call stack, and the frame’s variable names are suggested as you type. Results are listed under the box, newest at the bottom, and Clear empties the list.

  • The app doesn’t pause when it throws. Set a breakpoint in the catch or just before the throw.
  • There are no conditional breakpoints, logpoints or keyboard shortcuts for stepping.
  • The Debugger attaches to one device at a time. If more than one device runs your app on the same Metro, the Connection panel shows which one it uses. Close the app on the others.
  • No sources yet: check the app is running and the Metro port in Settings > Connection matches the one Metro is on.
  • This file’s source isn’t available: the bundle’s source map has no source for this file.