Composable not being drawn

Hey, I have a function that draws a composable,

@Composable
        fun home() : @Composable RowScope.() -> Unit {
            return {
                BottomNavigationItem(
                    icon = {
                        Icon(Icons.Filled.Home, "Home")
                    },
                    onClick = {},
                    selected = false,
                    label = {
                        Text("Home")
                    }
                )
            }
        }

That doesn't draw it to the GUI I am calling it with

@Composable
fun App() {
    MaterialTheme {
        BottomAppBar {
            StaticAssets.BarButtons.home()
        }
    }
}

Does anyone know why it doesn't work?

5 points · 2 comments · view on lemmy.world

2 Comments

sebschaef@feddit.de · 1 pts · 3y (1 reply)

A Composable is not meant to return anything if it draws something. In your case it should look like this:

@Composable
fun Home() {
    BottomNavigationItem(...)
}
spi@programming.dev · 1 pts · 3y

Found out why apparently you have to .invoke it because it needs to be in a rowscope