I am trying to implement an onClick handler for a Compose TextField. Current functionality is to handle the TextField click but disable manually editing of the field. For my use case I would like to handle the click and do something else. I would like to keep the look and feel of a TextField, and would like the focus animation to also happen.
the readOnly property gives me what I want from a UX perspective, however when I click on the TextField the onClick handler is not called.
TextField(
value = text,
onValueChange = { text = it},
readOnly = true,
modifier = Modifier
.clickable(onClick = {
Log.i("TextField", "Clicked")
})
)
I have also tried to use pointerInput, how I am having the same problem.
TextField(
value = text,
onValueChange = { text = it},
readOnly = true,
modifier = Modifier
.pointerInput(Unit) {
detectTapGestures(onTap = {
Log.i("TextField", "Clicked")
}
}
)
With Compose being so new its hard to tell if this is a bug or intended.