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
Colton Idle
10/25/2022, 1:32 PM
Any code to share? I'd love to try to repro.
a
Abdul Hafeez Sajid
10/25/2022, 1:41 PM
Sure wait, I’ll send you snippet.
Abdul Hafeez Sajid
10/25/2022, 2:08 PM
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.