Lilly
01/25/2021, 5:02 PMslideInVertically
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
01/26/2021, 1:00 AMinitialOffsetY
and targetOffsetY
are pixels, not dp. Perhaps that should be made more clear in the doc. 🙂Lilly
01/26/2021, 2:18 AM