Hello, I am facing some trouble tackling this scen...
# compose
a
Hello, I am facing some trouble tackling this scenario with Navigation Compose
image.png
So basically, in terms of nested navigation, I have a scaffold wrapping my app and a bottom bar, I have a destination that is part of one of the nested graphs that is inside the navhost, along with other routes in the bottom bar
As you can see in the picture in terms on context i am having trouble finding a good way to share the onClick of the button inside the destination screen and the onClick that is part of my bottom bar, they need to pass some arguments to the someDestination route
i want to keep the destination viewmodel separate of my root nav host, so i dont want to push it up in the hierarchy, One thing i tried is having a launched effect callback of when the data is loaded and then i can click and pass the same data on both onClick events, but this seems counter intuitive
Copy code
@Composable
fun RootGraph(
    navController: NavHostController = rememberNavController()
) {
    Scaffold(
        bottomBar = {
            NavigationBar {
                // click event
            }
        }
    ) {
        NavHost(
            navController = navController
                    startDestination = "destinationGraph"
        ) {
            home(
                oncClick = {
                    // same click event as navigation bar
                }
            )
            somethingElse()

            someDestination() // bottom bar hidden here
        }
    }
}