accompanist
accompanist copied to clipboard
BottomBar not placed correctlly after first navigation
Bug
I am developing an app that has nested navigation with Navigation Animation lib and HorizontalPager in the home screen. after first navigation from splash screen to the home screen, the bottom bar appears at the top of the screen. this happens after i change accompanist version from 0.25.0 to 0.26.0-alpha. in 0.25.0 it works as expected
MainActivity
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
MarvinTheme {
val navHostController = rememberAnimatedNavController()
Scaffold(
modifier = Modifier
.navigationBarsPadding(),
bottomBar = { BottomBar(navHostController = navHostController) }
) {
SetupNavGraph(navHostController = navHostController, paddingValues = it)
}
}
}
}
}
RootNavGraph
@Composable
fun SetupNavGraph(navHostController: NavHostController, paddingValues: PaddingValues) {
AnimatedNavHost(
navController = navHostController,
startDestination = Graph.Boarding.route,
route = Graph.Root.route
) {
boardingNavGraph(navHostController)
// authNavGraph(navHostController) TODO
homeNavGraph(navHostController, paddingValues)
}
}
repo: https://github.com/KavrinDEV/Marvin
the root of the bug is unclear to me so if additional code is required i will add it to the issue
i also tested this on emulator with API 32 and physical device API 27
Screenshots
Same issue
Had similar issue, please check if you have placed contents of bottomBar
in AnimatedVisibility
. For me that was the issue.
Once I removed the AnimatedVisibility
wrapper from NavigationBar the issue was resolved.
Here's a link to the commit for the same
@static-var thanks for the comment. i am not working on my project currently but i don't think animated visibility is the main problem. it should be possible to use it with bottomNavbar.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.