this is my code ```@Composable @Preview(showBackgr...
# compose
a
this is my code
Copy code
@Composable
@Preview(showBackground = true)
fun DefaultRecipeCard() {
    Scaffold(topAppBar = {
        TopAppBar(
            title = {
                Text(text = "ComposablecookBok")
            }
        )
    }, bodyContent = {
        RecipeList(defaultRecipes)
    }, bottomAppBar = BottomAppBar {
        Text(
            text = "Jetpack Compose",
            modifier = Modifier.padding(16.dp)
        )
    }
    )
}
n
This worked for me 😉
Copy code
bottomBar = {
    BottomAppBar(content = {
        BottomNavigationItem(
            icon = {
                Icon(Icons.Default.Person)
            },
            selected = bottomBarSelectedIndex == 0,
            onSelected = { bottomBarSelectedIndex = 0 },
            activeColor = Color.Magenta,
            inactiveColor = Color.LightGray
        )
        BottomNavigationItem(
            icon = {
                Icon(Icons.Default.Favorite)
            },
            selected = bottomBarSelectedIndex == 1,
            onSelected = { bottomBarSelectedIndex = 1 },
            activeColor = Color.Magenta,
            inactiveColor = Color.LightGray
        )
        BottomNavigationItem(
            icon = {
                Icon(Icons.Default.Settings)
            },
            selected = bottomBarSelectedIndex == 2,
            onSelected = { bottomBarSelectedIndex = 2 },
            activeColor = Color.Magenta,
            inactiveColor = Color.LightGray
        )
    })
},
and this is the
bottomBarSelectedStateIndex
Copy code
var bottomBarSelectedIndex by state { 0 }
👏🏼 1
t
In dev14 it is "bottomBar =" and not "bottomAppBar ="
👍🏼 1
m
You need to call lambda that will will invoke BottomAppBar @Composable as a slot.
Copy code
bottomAppBar = BottomAppBar {
        Text(
            text = "Jetpack Compose",
            modifier = Modifier.padding(16.dp)
        )
    }
should become
Copy code
bottomAppBar = { 
    BottomAppBar {
        Text(
            text = "Jetpack Compose",
            modifier = Modifier.padding(16.dp)
        )
    }
}
Haha, just saw that Adam answered below, nvm %)
a
Thanks @nglauber, @Timo Drick, @matvei for the comments
👍 1