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
- 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.
- 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?
When navigating between two components (e.g.,
GalleryComponent->PhotoComponent) using aChildStackwith 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 theChildStack'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
PhotoComponentinto a standaloneChildSlotand place both theChildStackandChildSlotinside aBox. While this successfully achieves the "overlap" effect, it breaks the shared element transition because the components reside in differentAnimatedVisibilityScopecontexts.