FYI, the `transitionDefinition` based transitions ...
# compose
d
FYI, the
transitionDefinition
based transitions have been deprecated in alpha 11. The replacements are: updateTransition and rememberInfiniteTransition for the finite and infinite use cases, respectively. I know it's a large amount of API change. πŸ˜… Hopefully, the new API is more straightforward to use. If you have any questions about them, or any issue with your migration, please let me know. I'm happy to help. πŸ™‚
πŸ™πŸΌ 1
πŸŽ‰ 12
⏸️ 1
r
This is the first time I am happy to hear about a deprecation announcement from android, however it will annoy many developers πŸ˜ƒπŸ˜ƒπŸ˜ƒπŸ˜ƒ
πŸ˜‚ 1
a
just read through the docs, looks really nice πŸ₯³
πŸ™ 1
b
just migrated to the new API for one of my composable. the samples provided helped a lot and code is now a lot more readable
πŸŽ‰ 1
r
Hi @Doris Liu How can we call suspend functions from inside Modifier.drawBehind scope?
d
@rsktash Are you trying to call
Animatable.animateTo
? First
rememberCoroutineScope
from the composable, and
launch
a coroutine in the modifier similar to this: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]lingDemo.kt;drc=b40ab8e06820b1c02795daca34142fd3c482dc1c;l=58
The
CoroutineScope
returned from
rememberCoroutineScope
effectively scopes the lifecycle of the animation to the composable. When the composable leaves composition, animation will be automatically cancelled as a result of the
CoroutineScope
getting cancelled. πŸ™‚
r
What is the replacement for
onStateChangeFinished
from the old transitions api. It was a cool way to know when the state transition was completed.
d
It can be achieved by checking the
Transition.currentState
against
Transition.targetState
. They are the same when state transition is completed.
βœ… 2
r
@Doris Liu Thank you You are very helpful
πŸ‘ 1
t
Loving these Transition APIs!
πŸŽ‰ 2
r
Hi @Doris Liu We are having issue when using crossfade animation. https://issuetracker.google.com/u/0/issues/178729296 Thank you
d
@rsktash Are you building against alpha 11 or a more recent compose build? If you are having the issue on the same compose desktop build as noted in the issue linked above, we have a fix for it in the pipeline. If you see the same behavior on alpha 11, please add that info to the bug. (For future reference, it's recommended to start a separate thread for a separate topic like this. That way more people would see your question, and you could potentially get help from them sooner than when I get to it. πŸ™‚ )