Hello! Is it possible to use the old navigation co...
# compose
v
Hello! Is it possible to use the old navigation component and as a destination declare a fragment that uses the compose navigation component? I was thinking about implementing the new features like that in order to start implementing compose nav graphs before being fully migrated but it seems that it does not work...
It seems that the issue was that in each composable we had something like that:
Copy code
@Composable
fun Screen(
    vm: screenViewModel = viewModel() 
)
By changing the code to inject viewmodels in the navgraph it worked...
Copy code
@Composable
fun MyGraph(
    vm: screenViewModel = viewModel() 
) {
   NavHost(...) {
      composable(...) {
          Screen(vm = vm)
      }
   }
}

@Composable
fun Screen(
    vm: screenViewModel 
)
Why does this happen? We are going to end-up with many ViewModels in the graph by doing that...
hmmm...
hiltViewModel()
fixes that too...