Zoltan Demant
02/24/2022, 10:30 AMAnimatedContent
(and its variants); if the targetState
changes at all, even if it doesnt result in a new animation running, there will be additional recompositions as a result (I was seeing 2-9, instead of 1). I learned this the hard way, Id normally specify what I wanted to render as the targetState
and use transition.contentKey
to key it correctly; stripping out the stuff not directly related to the animation made an immense difference. Ill share some more details in the thread for anyone interested, I dont think this is a bug, but rather me misunderstanding how it works - hopefully it can save you from doing the same mistake as I did!AnimatedContent(
targetState = size,
transitionSpec = Transition,
content = { size ->
// Content for size
}
)
And if theres any other data associated with size in this case, Id store it elsewhere outside of the targetState... e.g. in a remembered value, etc.Illustrator
02/25/2022, 1:20 AMZoltan Demant
02/25/2022, 6:06 AMChris Sinco [G]
02/26/2022, 1:36 AM