Skip to content

[0.86] Fix IllegalStateException in SurfaceMountingManager.removeViewAt (#57860) #1402

Description

@inspiredtomas

Target Branch

0.86

Link to commit or PR to be picked

react/react-native@3f553d76b (PR react/react-native#57860)

Description

On the new architecture on Android, the Fabric differ can still emit a removeViewAt mount instruction whose parent tag resolves to a view that is not a ViewGroup (in our case an unflattened View child of a FlatList header). SurfaceMountingManager.removeViewAt then throws IllegalStateException("Unable to remove a view from a view that is not a ViewGroup…"), which is fatal: the host tears the surface down and users are left on a blank gray screen until they relaunch the app.

We hit this in production and on staging on 0.86.x with fixDifferentiatorParentTagForUnflattenCase enabled (see react/react-native#57800), reproducing via a Home-tab re-tap that resets a feed whose header holds a carousel.

3f553d76b (merged to main on 2026-08-10) turns the throw into a ReactNoCrashSoftException + early return, the same treatment addViewAt already gets. It is a single-file, self-contained change with no public API impact, and it applies cleanly on top of the stable branch. Please consider it for the next patch release; the crash class is a full-surface teardown, so the soft exception is a large improvement even before the differ inconsistency itself is fixed.

Repro details and Sentry traces available on request.

Activity

  1. EliandroDevWme commented on Sep 29, 2026

    @EliandroDevWme

    +1 for picking #57860 into 0.86. We ship on Expo SDK 57 (RN 0.86.2 → 0.86.3) and hit the fatal removeViewAt "not a ViewGroup" crash in production on a low-end Android 12 device (moto e22, 2 GB RAM, armeabi-v7a). No app frames in the stack. In our case the trigger was bursts of remounts (a component type declared inside render, so each state update remounted a subtree with SVG icons) while the JS thread was yielding from a long synchronous task. We removed the remount bursts on our side, but the differ bug remains, and Expo SDK 57 apps can't move to 0.87/0.88 yet, so a 0.86.4 with this pick would turn a fatal crash into a soft error for us.

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions