Skip to content

[Reanimated 4][Android] Animated.View with exiting animation gets stuck on screen on unmount #9170

@pthorsson

Description

@pthorsson

Description

When using entering/exiting layout animations on Animated.View components, the component can get stuck on screen even after it has been removed from the React tree. The view remains visible indefinitely and cannot be cleared without reloading the app.

This seems to happen when layout animations are running while the UI thread is under heavy or spiky load.

reanimated4-bug.mov

I also want to point out that it works as expected with Reanimated 3 (on fabric).

Steps to reproduce

The reproduce repo renders a fixed grid of slots where each slot conditionally mounts an Animated.View with entering={ZoomIn} and exiting={ZoomOut}. Items cycle through mount → unmount every 100ms. Every second, a spike of 30 additional short-lived animated views is mounted and immediately unmounted to stress the UI thread.

Steps:

  1. Clone the repo and run on an affected device
  2. Tap Start — items begin cycling in and out with zoom animations
  3. Observe that items sometimes remain stuck on screen after the spike, even though they are no longer in the React tree

Note: The SPIKE_COUNT and SPIKE_INTERVAL_MS constants in src/App.tsx may need to be tweaked per device to create a sufficient spike without crashing.

Tested on device and emulators

Device Android Version Managed to reproduce
Galaxy Tab Active4 Pro 5G (SM-T636B) 15 Yes (most frequent)
Pixel 7a 16 Yes
Galaxy Tab S9+ (SM-X810) 15 No
Android Studio Emulator 15 Yes
Expo Snack Emulator 16 No (tried multiple Android devices)

Snack or a link to a repository

https://github.com/pthorsson/reanimated4-layout-animations-bug

Reanimated version

4.1.1 4.2.3

Worklets version

0.5.1 0.8.1

React Native version

0.81.5

Platforms

Android

JavaScript runtime

Hermes

Workflow

Expo Dev Client

Architecture

New Architecture (Fabric renderer)

Reanimated feature flags

No

React Native release level

Stable

Build type

Debug app & dev bundle

Device

Real device

Host machine

macOS

Device model

Galaxy Tab Active4 Pro 5G (SM-T636B)

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidThis issue is specific to AndroidRepro providedA reproduction with a snippet of code, snack or repo is provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions