Jetpack Compose TextField Click

December 15, 2021

Seems like Modifier.clickable doesn’t work for TextField.

val source = remember { MutableInteractionSource() }

if (source.collectIsPressedAsState().value) {
    Timber.d("Click Me")
}

OutlinedTextField(,
    value = "Click Me",
    onValueChange = {  },
    label = { Text("Test") },
    singleLine = true,
    readOnly = true,
    interactionSource = source
)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.