Decompose icon indicating copy to clipboard operation
Decompose copied to clipboard

Stabilise the Compose Animations API

Open arkivanov opened this issue 2 years ago • 9 comments

Docs: link. Collecting feedback and use cases here.

Points to improve:

  • [x] Get rid of Direction.IDLE using movableContentOf (blocked by Compose 1.2.0 release)
  • [ ] Make click interception configurable? Or replace with another solution? See b/214231672
  • [x] Nullable StackAnimator in StackAnimation selector
  • [x] Shared element transitions (perhaps LookaheadLayout + movableContentOf should work out of the box when they land in Compose)
  • [x] Add otherChild argument to stackAnimation selector

arkivanov avatar May 18 '22 11:05 arkivanov

It would be nice to have a shared element transition between configurations, not sure if something similar to this sample could be done with Decompose?

plusmobileapps avatar Jul 24 '22 08:07 plusmobileapps

I have a pending branch that should make it compatible with the official shared transitions (LookaheadLayout + movableContentOf) when they land in Compose. The branch is blocked by the availability of movableContentOf. Waiting for the stable MPP Compose 1.2.0.

arkivanov avatar Jul 24 '22 08:07 arkivanov

Actually, I found that LookaheadLayout is already available to try in Compose 1.3.0-alpha01. I will play with it and provide some updates here.

arkivanov avatar Jul 24 '22 09:07 arkivanov

Yep, LookaheadLayout + movableContentOf should work just fine even with the current animations API. It is already available in Compose 1.3.0-alpha01, however there are immediate bugs, e.g. LookaheadLayout doesn't support having LazyColumn inside, etc.

https://user-images.githubusercontent.com/26204457/180651812-462d4661-20e3-48e8-a0cb-6d341843e3c2.mov

arkivanov avatar Jul 24 '22 14:07 arkivanov

It seems like the animation documentation is out of date since the stack navigation changes. I'm assuming childAnimation is supposed to be stackAnimation?

plusmobileapps avatar Jul 26 '22 18:07 plusmobileapps

Thanks for raising! I updated the documentation a while ago with multiple rounds of self code review, but seems like I missed this one.

arkivanov avatar Jul 26 '22 18:07 arkivanov

@arkivanov Hi. Is it possible to use AnimatedContent with Decompose?

aartikov avatar Sep 04 '22 11:09 aartikov

@aartikov Technically it should be possible. E.g. the Child Stack just exposes Value<ChildStack<C, T>> - so you can use something your own instead of the Children function, with AnimatedContent. You can also try the StackAnimation { } function that just provides the current ChildStack and it's up to you how to render children.

arkivanov avatar Sep 04 '22 12:09 arkivanov

@arkivanov Thank you!

aartikov avatar Sep 05 '22 12:09 aartikov