Anyone else had an issue with AnimatedVisibility u...
# compose
n
Anyone else had an issue with AnimatedVisibility using fadeIn / fadeOut where the content has a complex shaped background & shadow. In the fadeIn part of the animation it’s treating the background and shadow as if it was not defined with the Shape and then in the end it’s adding the shadow and complex background shape in an instant. If I just use e.g. slideInVertically alone it works fine. This is the code (I also tried only with the fade animation and clip = true):
Copy code
AnimatedVisibility(
    visible = viewModel.show,
    enter = slideInVertically() + fadeIn(initialAlpha = 0f),
    exit = slideOutVertically() + fadeOut()
) {
Box(
    modifier = Modifier
        .shadow(elevation = 5.dp, shape = TooltipShape(0.7f), clip = false)
        .background(color = Color.White, shape = TooltipShape())
        .padding(horizontal = 12.dp, vertical = 14.dp)
) {
    content()
}
d
fadeIn
and
fadeOut
uses a
Modifier.graphicsLayer
under the hood for animating alpha. When alpha is not 1f, there's an implicit clipping to bounds, as the layer is sized to the bounds of the composable. See a similar discussion: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1633007272301100
🙏 1