Skip to content

React Native overlay: collapsed LogBox banner with a count badge (2+ entries) is not detected #4787

Closed

Description

@toongri

Summary

The collapsed React Native LogBox banner is detected only while it holds one log entry. With two or more entries, React Native renders the count instead of !, so the banner label starts with a number (20, Failed to …). No collapsed-warning pattern matches that label. react-native dismiss-overlay then reports No React Native overlay detected, snapshots carry no overlay hint, and a press on a control under the banner opens the full LogBox inspector instead.

Environment

  • agent-device 0.21.40 (observed). The detection code is byte-identical on main at 115c83a8 and in 0.21.41.
  • Android emulator, React Native 0.86.3 app, debug build (Metro, __DEV__ true).

Current state (evidence)

Symptom. The app's background polling failed for several minutes and logged console.error each time. The collapsed banner at the bottom of the screen grew from 8 to 20 entries. Its label in the snapshot was 20, Failed …. Then:

$ agent-device react-native dismiss-overlay
No React Native overlay detected

The next step pressed a button whose rect overlapped the banner (button y 2190–2337 px, banner y 2146–2271 px, press at y 2264). The diff after the press showed the LogBox inspector (Dismiss, Minimize) instead of the expected screen.

Why the label starts with a number. Libraries/LogBox/UI/LogBoxNotificationCountBadge.js:28 renders {props.count <= 1 ? '!' : props.count}. So the badge text is ! for one entry and the count (2 or more) otherwise. The badge text and the message are children of one Pressable (LogBoxNotification.js:42-58). Both platforms join the children's text into the button's label with ", ":

  • Android: ReactAccessibilityDelegate.getTalkbackDescription joins non-focusable children with ", ". The dismiss button is a focusable Pressable, so it is left out.
  • iOS: RCTRecursiveAccessibilityLabel joins child labels with ", ".

The resulting label is "<count>, <message>", e.g. 20, Failed to fetch ….

Local probe. I ran the 0.21.40 detector on synthetic nodes with the banner's rect:

Label detected action
!, Failed to fetch true close-collapsed-banner
20, Failed to fetch false —
Error: Failed to fetch false — (intended since #4366)

Code path (main 115c83a8; identical in v0.21.40 83328f1d):

  • packages/contracts/src/react-native-overlay.ts:9-14: COLLAPSED_WARNING_PREFIX_PATTERNS holds /^!,\s+/, the generic severity prefix and the unhandled-rejection pattern. No pattern accepts a numeric count.
  • packages/contracts/src/react-native-overlay.ts:44-66: isReactNativeCollapsedWarningLabel and isReactNativeCollapsedWarningEvidenceLabel build on those patterns.
  • packages/capture-kit/src/react-native-overlay.ts:189-191: isCollapsedWarningSummaryLabel checks only /^!,\s+/. isSafeCollapsedWarningCoordinateFallback (197–203) inherits the same limit.
  • packages/daemon/src/execution/handlers/react-native.ts:109: emits No React Native overlay detected when the facts come back empty.
  • packages/capture-kit/src/ios-snapshot-engine/noise-overlay.ts:88-103: the iOS full-screen wrapper suppression also uses the contracts label check, so it likely misses count banners too. I inferred this from the source and have not measured it on a device.

Existing tests (packages/capture-kit/src/react-native-overlay.test.ts, packages/daemon/src/execution/handlers/__tests__/react-native.test.ts) use only !, …, Error: and Warning: labels. I found no issue or PR about the count badge (searched LogBox, collapsed banner, dismiss-overlay, badge, LogBoxNotificationCountBadge). #554, #565, #566, #577, #641 and #4366 cover the !, banner only.

Reproduction

  1. In a React Native debug build (for example examples/test-app), log two warnings or errors on a screen, e.g. call console.error('first') and console.error('second') in an effect. PR fix: harden React Native overlay dismissal #641 used the same kind of temporary trigger.
  2. Wait until the collapsed banner shows 2 in the badge.
  3. agent-device snapshot -i: the banner's label is 2, second (or similar), and no overlay hint is printed.
  4. agent-device react-native dismiss-overlay: prints No React Native overlay detected.
  5. Log one more entry and repeat with the same result. With a single entry (!), steps 3–4 detect and dismiss the banner.

Required behavior

A collapsed LogBox banner is detected and dismissable regardless of the entry count. Ordinary UI whose label starts with a number, such as 2, Morning in a list row or 3, Cart on a tab, is not treated as a banner.

Completion conditions

  • react-native dismiss-overlay closes a collapsed banner whose badge shows 2 or more, on Android and iOS.
  • Snapshot overlay hints appear for count banners as they do for ! banners.
  • Detector tests cover count labels, and numeric-prefixed labels that are not LogBox (list rows, tabs, prices such as 20,000원) stay undetected.

Suggested fix

  1. Accept ^(?:[2-9]|[1-9]\d+),\s+\S as a collapsed-banner label only together with the banner geometry. In a local patch I required: the existing collapsed-banner size checks, a width of at least 80% of the screen (LogBox insets the banner 10 pt on each side), and a bottom edge within max(160, 15%) of the screen bottom (LogBox anchors the banner at bottom: 20). With those checks, my probe still detected the count banner and rejected mid-screen, top-of-screen and tab-bar labels. It still accepted one false positive: a full-width row with a label like 3, Evening pinned to the bottom edge.
  2. Put the condition in the contracts label check, so capture-kit detection and the iOS wrapper suppression change together.
  3. If the accessibility tree exposes it, anchoring on LogBox's own structure (the badge Text has id="logbox_notification_count_text") would remove that remaining false positive. I have not checked whether either platform's tree surfaces that id.

Workaround

Turning LogBox off on screen in automated runs (LogBox.ignoreAllLogs()) avoids the banner. Errors still reach console, and fatal errors still open the inspector.

Activity

  1. added
    bug
    on Nov 21, 2026
  2. thymikee commented on Nov 21, 2026

    @thymikee
    Member

    Triage: bug; actionable without more input from you. Both detectors accept only the !, prefix (packages/contracts/src/react-native-overlay.ts:10, packages/capture-kit/src/react-native-overlay.ts:189), so the collapsed banner with a count badge drops out. The fix belongs in the contracts label check, so detection and the iOS wrapper suppression change together. It anchors on the badge id if either tree exposes it, otherwise on the banner geometry. Your negative cases become tests.

  3. added
    in-progress
    on Nov 21, 2026
  4. thymikee commented on Nov 21, 2026

    @thymikee
    Member

    An agent is picking this up; the PR will link here.

  5. removed
    in-progress
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions