Assigned
Status Update
Comments
al...@airbnb.com <al...@airbnb.com> #2
Can you try with the latest snapshot? Not reproducible for me on androidx-main.
No update yet.
Can you try with the latest snapshot? Not reproducible for me on androidx-main.
Description
Jetpack Compose version: 2024.12.01
Jetpack Compose component used:
AnimatedContent
ContentTransform
currently exposes an API for providing an absolute z-index value for the incoming (target) content withtargetContentZIndex
. This works great if the layering of your content is well defined and finite. However, this API isn't easily adaptable to support a fully dynamic layering system.Example: Always perform a slide down transition.
This works fine the first time, because
-1 < 0
. However, for all subsequent changes,-1 == -1
so the incoming content is placed on top and the transition doesn't work. In order to make this work, we need to keep aFloatState
and decrement it every time we return a new transformation.This... works. But doesn't feel great. It's really easy to mess up and technically puts a limit on the number of transitions you can run, even if it's not a limit you'd ever realistically hit.
Two possibilities that come to mind:
AnimatedContent
only renders a handful of contents at the same time (usually 1-2). Once idle (e.g. showing one content), reset the z-index back to zero to avoid growing or shrinking to infinity.