accompanist icon indicating copy to clipboard operation
accompanist copied to clipboard

BottomBar not placed correctlly after first navigation

Open k4vrin opened this issue 1 year ago • 3 comments

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

Screenshot-20220802-172846.png

k4vrin avatar Aug 02 '22 13:08 k4vrin

Same issue

rezafaraji93 avatar Aug 24 '22 07:08 rezafaraji93

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 avatar Aug 26 '22 14:08 static-var

@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.

k4vrin avatar Sep 09 '22 17:09 k4vrin

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.

github-actions[bot] avatar Oct 10 '22 04:10 github-actions[bot]