Daniele B
02/17/2021, 2:42 PMD/InputDispatcher: Waiting to send key to Window{1bda786 u0 myapp.MainActivity} because there are unprocessed events that may cause focus to change
I am posting the code in a comment to this message.
Am I setting up the NavHost incorrectly? Is this warning meaningful or should I disregard it?
The app still works well.class MainActivity : AppCompatActivity() {
private val appViewModel: AppViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyAppTheme(appViewModel.KMPModel) {
Navigation(appViewModel.KMPModel)
}
}
}
}
This is the Navigation composable:
@Composable
fun Navigation(model: KMPViewModel) {
val appState by model.stateFlow.collectAsState()
val navController = rememberNavController()
NavHost(navController, startDestination = "master") {
composable("master") {
MasterView(model = model, masterState = appState.masterState) {
navController.navigate("detail/$it")
model.loadDetailItem(it)
}
}
composable("detail/{item}") { backStackEntry ->
val detailName = backStackEntry.arguments?.getString("item")!!
DetailView(model = model, detailState = appState.detailState, detailName = detailName)
}
}
}