Hey everyone, I am working in a projects where I ...
# compose
s
Hey everyone, I am working in a projects where I am planning to implement Navigation with Bottom bar.
Copy code
implementation "androidx.navigation:navigation-compose:2.4.1"

compose version, I tried both 1.1.0 and 1.2.0-alpha04
I am trying to use this and where I create and add the bottomBar , I got Skipped * frames! The application may be doing too much work on its main thread* without adding any view. my code snaps -
Copy code
@Composable
fun BottomNavigationBar(navController: NavHostController) {
    BottomNavigation(
        backgroundColor = AppColors.BottomNav,
    ) {
        val navBackStackEntry by navController.currentBackStackEntryAsState()
        val currentDestination = navBackStackEntry?.destination
        items.forEach { screen ->
            BottomNavigationItem(
                icon = {
                    Icon(
                        painterResource(screen.drawableResId),
                        tint = AppColors.secondary,
                        contentDescription = screen.route
                    )
                },
                label = { Text(stringResource(screen.resourceId)) },
                selected = currentDestination?.hierarchy?.any { it.route == screen.route } == true,
                onClick = {}
            )
        }
    }
}
Copy code
@ExperimentalMaterialApi
@ExperimentalFoundationApi
@Composable
fun SportWorldUi() {
    val navController = rememberNavController()
    Scaffold(
        topBar = { TopBar(navController) },
        bottomBar = { BottomNavigationBar(navController) },
//        backgroundColor = Color.Transparent,
        modifier = Modifier.fillMaxSize()
    ) { innerPadding -> }
If I remove
bottomBar = { BottomNavigationBar(navController) },
, it works fine. Where is the issue here? Thanks
🧵 1
It seems after adding multiple`BottomNavigationItem`, i am getting SKIPPED FRAME
e
not sure if this would help, but i had an issue with lag cuz i was using visibility animation with bottombar and a lot of calculating of the scaffold’s content size with innerpadding + column/row weight sizing while toggling the visibility of BottomBar per certain destinations reducing the number of size calculations, state changes, and/or a fixed height for a bottombar helped me eliminate