Might `slideInVertically` `slideOutVertically` be ...
# compose
l
Might
slideInVertically
slideOutVertically
be buggy? The initialOffsetY/ targetOffsetY should return the half of the content's height but this doesn't match. My content's height is 120 dp but value returns 376 dp 🤔
Copy code
@Composable
fun SlideVerticallyAnimationComponent(
    visibility: Boolean,
    offset: Int,
    content: @Composable () -> Unit
) {
    AnimatedVisibility(
        visible = visibility,
        enter = slideInVertically(initialOffsetY = { value ->
            Timber.e("valueIn: $value") // output: 376 dp
            offset
        }) + fadeIn(),
        exit = slideOutVertically(targetOffsetY = { value ->
            Timber.e("valueOut: $value") // output: 376 dp
            offset
        }),
        content = content
    )
}
d
Both the input and output to the
initialOffsetY
and
targetOffsetY
are pixels, not dp. Perhaps that should be made more clear in the doc. 🙂
l
Thank you very much for the info 🙏
👍 1