compose: search: Request focus on clearing textfield
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -141,7 +141,12 @@ private fun ScreenContent(
|
|||||||
},
|
},
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
if (textFieldState.text.isNotBlank()) {
|
if (textFieldState.text.isNotBlank()) {
|
||||||
IconButton(onClick = { textFieldState.clearText() }) {
|
IconButton(
|
||||||
|
onClick = {
|
||||||
|
textFieldState.clearText()
|
||||||
|
focusRequester.requestFocus()
|
||||||
|
}
|
||||||
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_cancel),
|
painter = painterResource(R.drawable.ic_cancel),
|
||||||
contentDescription = stringResource(R.string.action_clear)
|
contentDescription = stringResource(R.string.action_clear)
|
||||||
|
|||||||
Reference in New Issue
Block a user