Skip to content

[Bug]: Items overlap and layout breaks after returning from background (dynamic height with Reanimated) #592

Description

@V0V45

Description

Bug seems to be related to the #565, #286 and #349.
When using Sortable.Grid with items that have dynamically changing heights (e.g., expanding/collapsing sections animated with react-native-reanimated), the layout breaks after the app is sent to the background for an extended period (5-10 minutes) and then brought back to the foreground. As a result, items visually overlap each other. The bug is fixed automatically after starting a drag.
It's also worth noting that the bug does not appear every time — it happens intermittently.

Steps to reproduce

  1. Run the provided example on an Android device.
  2. Tap "Item 2" to expand it, and click "+ Add" a few times to increase its height.
  3. Lock the device or send the app to the background.
  4. Wait for 5-10 minutes.
  5. Unlock the device and bring the app to the foreground.
  6. Observe the overlapping SortableItem components. If the bug does not appear, repeat from step 2.
Image

Code snippet, Snack or GitHub repository link

https://github.com/V0V45/sortables-layout-bug

React Native Sortables version

^1.9.4 with patch from: #579

Reanimated version

4.5.0

React Native Gesture Handler version

~2.32.0

React Native version

0.86.0

Platforms

Android

Architecture

Fabric (New Architecture)

Workflow

Expo Dev Client

Device

Real device

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions