Zoltan Demant
09/12/2022, 9:55 AMAnimatedContent
. Theres almost always a slight stutter when using it to transition to a new screen; and its almost always exclusive to the first time the screen is shown - from there and on the transition is smooth for as long as the app is running. Using R8, baseline profiles, etc. Is this a known issue; or am I simply doing something wrong? Ill attach a simple code example in the thread. 🧵Zoltan Demant
09/12/2022, 10:00 AMloading -> content
transition. TargetState is the value/screen Im looking to show, which is null for the duration of the load.
updateTransition(
targetState = targetState,
label = null,
).AnimatedContent(
contentKey = { value -> value != null },
transitionSpec = {
with(TransitionScope(this)) {
if (requiresAnimation) {
transition().invoke()
} else {
Empty
}
}
},
content = { available ->
val currentContent = content
if (available && currentContent != null) {
LogComposition("content")
Render(currentContent)
} else {
LogComposition("loading")
Loader(Full)
}
},
)
Render(currentContent)
leads to 1 recomposition of the screen itself. The content block is invoked a bunch of times during the animation, but no work is really done thanks to skipping. Here are the logs for that:
Recomposed loading #0
Recomposed loading #1
Recomposed content #0
Recomposed loading #2
Recomposed content #1
Recomposed content #2
Recomposed content #3