Skip to content

Support for "Overlay" visibility in ChildStack for Shared Transitions #994

Description

@yueban

When navigating between two components (e.g., GalleryComponent -> PhotoComponent) using a ChildStack with a shared element transition, the "underlying" component (GalleryComponent) is removed from the composition as soon as the transition completes.

This becomes problematic when the top-level component (PhotoComponent) has a transparent or semi-transparent background (e.g., a "hero" image view with a background alpha that the user can drag or swipe away). Currently, once the transition settles, the background becomes empty/black because the previous stack item is no longer present in the ChildStack's active state.

Expected Behavior

There should be a mechanism to keep the previous component in the composition when the current component is marked as an "overlay" or "transparent," allowing it to remain visible behind the active child.

Possible Solutions

  1. I tried to isolate PhotoComponent into a standalone ChildSlot and place both the ChildStack and ChildSlot inside a Box. While this successfully achieves the "overlap" effect, it breaks the shared element transition because the components reside in different AnimatedVisibilityScope contexts.
  2. Since the predictive back gesture already handles this visibility perfectly during the drag (rendering multiple items at once), could this logic be extended to the settled state for specific components?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions