The onKeyEvent does not stop propagation, it's cal...
# compose-desktop
f
The onKeyEvent does not stop propagation, it's called 2 times event.
Copy code
var text by remember { mutableStateOf("") }

MaterialTheme {
  Column {
        TextField(value = text,
          modifier = Modifier.onKeyEvent {
                  if (it.key == Key.C) {
                     println("Input Key!")
                  }
                  true // return true for stop propagation
                },
          onValueChange = { text = it },
          label = { Text("Search") }, singleLine = true
        )
 }}
c
Are you sure it's not just being called for a key down and a key up?
a
"stop propagation" means you have handled the event so it won't be propagated up to the parent. It doesn't mean you won't receive following events.
I was talking to OP. If you have another question just start a new thread.
k
ok. sorry..
a
Also as Chris said two events (down and up) for a single key press is expected. You can check
KeyEvent.type
.
f
Thx, Solved with KeyEventType