Jan Skrasek
01/29/2021, 11:45 PMerror: @Composable (() -> Unit)? = null
i.e. a rendering lambda of the error or a null.
I want to animate that rendering, so I need to postpone "nulling" the error until the hide animation finishes. How can I remember the composable result?
Box(
modifier = Modifier
.alpha(errorAlpha.value)
) {
if (error != null) {
error()
}
}
var errorState by remember { mutableStateOf(error) }
if (error == null) {
LaunchedEffect(this) {
delay(AnimationDuration.toLong())
errorState = null
}
} else {
errorState = error
}