Hi, I am using a BasicTextField inside a Surface. ...
# compose
a
Hi, I am using a BasicTextField inside a Surface. If I set Surface enabled = true, I am able to edit text in BasicTextField. But if Surface is set to enabled = false then I can’t edit BasicTextField. I can’t click on it to request focus. Any help?
c
Any code to share? I'd love to try to repro.
a
Sure wait, I’ll send you snippet.
Check this out:
Copy code
var text by remember {
    mutableStateOf("Hello World!")
}

Column(modifier = Modifier.padding(16.dp)) {
    Surface(modifier = Modifier.clickable(enabled = false) {}) {
        BasicTextField(value = text, onValueChange = {
            text = it
        })
    }
}
if you set enabled = true, it starts editing otherwise not.