Hello, I've some questions regarding compose botto...
# compose
c
Hello, I've some questions regarding compose bottom navigation and navcontroller. I have my navController defined in navigation composable which has routes screen, and bottom navigation bar has 4 Screens. I need current navBackStackEntry and current destination in NavigationBar composable, so to get access to them should I pass navController to HomeScreenComposable and there down to BottomNavigaitonBar? I though it was bad practice to pass navController to composables for testing purposes. Also can i just re-instantiate a navController inside BottomNavigation, would I receive the same navController with the one in main Navigation composable(just above NavHost), I think not? I have enum class and list of tabs declared already by the way. correction: navController defined inside mainActivity inside setContent
c
I think a more optimal approach would be for the bottom nav bar to be able to communicate upwards a desire to change the current screen
c
So are you saying that I should pass the navController to HomeScreenComposable (hosts Scaffold with bottomNavigation) and then pass down to bottomNavigation? I was told to never pass navController and instead pass lambdas, but it looks like I have no other options.
c
No, I'm saying you should pass a lambda down which will be created at the top level, and passed down to the bottom navigation, such that on a tab being selected, you'd invoke the lambda with an enum value or equivalent such that at the top where your nav controller is you can handle the navigation
c
Yes I understand now, just like the normal navigation inside composables. Thank your for your help