Thread
#compose
    l

    Lilly

    1 year ago
    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 🤔
    @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
        )
    }
    Doris Liu

    Doris Liu

    1 year ago
    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

    Lilly

    1 year ago
    Thank you very much for the info 🙏