My use case is that I have a form in which some fields are filled out manually and others take the user to a screen where they can search for the value they want in a large list. The fields that simply take user input are working fine but when I try to add the property readOnly = true to the TextField Composable I am presented with the following error:
None of the following functions can be called with the arguments supplied.
TextField(TextFieldValue, (TextFieldValue) → Unit, Modifier = ..., TextStyle = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., Boolean = ..., VisualTransformation = ..., KeyboardOptions = ..., Boolean = ..., Int = ..., (ImeAction, SoftwareKeyboardController?) → Unit = ..., (SoftwareKeyboardController) → Unit = ..., InteractionState = ..., Color = ..., Color = ..., Color = ..., Color = ..., Shape = ...) defined in androidx.compose.material
TextField(String, (String) → Unit, Modifier = ..., TextStyle = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., Boolean = ..., VisualTransformation = ..., KeyboardOptions = ..., Boolean = ..., Int = ..., (ImeAction, SoftwareKeyboardController?) → Unit = ..., (SoftwareKeyboardController) → Unit = ..., InteractionState = ..., Color = ..., Color = ..., Color = ..., Color = ..., Shape = ...) defined in androidx.compose.material
I am assuming that this error has something to do with my arguments not matching up with the provided overrides for TextField but I can't seem to find anything in the documentation for how I should be using this property other than simply supplying it with a Boolean value. I was looking here for the documentation.
The code is:
TextField(
value = statefulValue,
onValueChange = {},
label = {
Text("Label")
},
placeholder = {
Text("Search items")
},
trailingIcon = {
Icon(
imageVector = Icons.Filled.Search
)
},
readOnly = true
)
I am using version androidx.compose.material:material:1.0.0-alpha09 of the Compose Material package and alpha09 for the rest of my compose dependencies as well.