jannis
10/19/2021, 9:38 AMcb
10/19/2021, 9:58 AMAnimatedContent
over it too, to animate the change:
bottomBar = {
if (LocalWindowInsets.current.ime.isVisible) {
BottomNavigation(...)
}
}
jannis
10/19/2021, 10:10 AMChris Miller
10/19/2021, 10:49 AMisVisible
returns true from the moment the animation starts displaying the keyboard. It also returns false the moment the animation starts when hiding the keyboard. So you may want to check for isVisible || animationInProgress
.
In the end I didn't do the above as it was proving fiddly for my particular setup. Instead I wrapped the bottom nav with the following composable:
@Composable
fun HideFromIme(content: @Composable () -> Unit) {
AnimatedVisibility(
visible = !LocalWindowInsets.current.ime.isVisible,
enter = expandVertically(),
exit = shrinkVertically(),
) {
content()
}
}
That gave a pretty smooth transition of the bottom nav disappearing as the keyboard appears (and vice versa).jannis
10/19/2021, 10:57 AMAnimatedVisibility
indeed gave me a good result. Thanks for the hint! ❤️