Ravi
05/18/2021, 9:22 PMAnimatedVisibility(visible = true, initiallyVisible = false, enter = fadeIn()) { //<=beta06
initiallyVisible
is removed in beta07
@ExperimentalAnimationApi
@Composable
fun AnimatedVisibility(
visible: Boolean,
modifier: Modifier = Modifier,
enter: EnterTransition = fadeIn() + expandIn(),
exit: ExitTransition = shrinkOut() + fadeOut(),
content: @Composable() AnimatedVisibilityScope.() -> Unit
) {
val transition = updateTransition(visible)
AnimatedEnterExitImpl(transition, { it }, modifier, enter, exit, content)
}
Zach Klippenstein (he/him) [MOD]
05/18/2021, 9:26 PMZach Klippenstein (he/him) [MOD]
05/18/2021, 9:28 PMDoris Liu
05/18/2021, 9:44 PMinitiallyVisible
is to eliminate the guess work around what should happen when initiallyVisible
changes: should it 1) start a new animation, or 2) ignore it if visible
parameter didn't change? It's more clear to express the initiallyVisible
equivalent in a MutableTransitionState
, where the if you were to change the initial state you'll have to create a new MutableTransitionState
instance. A new instance would lead to a new animation if the targetState and currentState differ.Doris Liu
05/18/2021, 9:47 PMMutableTransitionState
that I was referring to 🙂: https://developer.android.com/reference/kotlin/androidx/compose/animation/package-summary#AnimatedVisibility(androidx[…]Transition,kotlin.Function1)