Skip to content

Commit

Permalink
Add callback to clean up the input text
Browse files Browse the repository at this point in the history
  • Loading branch information
masah517 committed Sep 10, 2024
1 parent 7c324c9 commit 3f470de
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ internal fun EditScreen(
nickname = it
onChangeNickname(it)
},
onInputClear = {
nickname = ""
onChangeNickname("")
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
)
InputFieldWithError(
Expand All @@ -427,6 +431,10 @@ internal fun EditScreen(
occupation = it
onChangeOccupation(it)
},
onInputClear = {
occupation = ""
onChangeOccupation("")
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
)
val linkLabel = stringResource(ProfileCardRes.string.link)
Expand All @@ -440,6 +448,10 @@ internal fun EditScreen(
link = it
onChangeLink(it)
},
onInputClear = {
link = ""
onChangeLink("")
},
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Done,
keyboardType = KeyboardType.Uri,
Expand Down Expand Up @@ -531,6 +543,7 @@ private fun InputFieldWithError(
errorMessage: String,
textFieldTestTag: String,
onValueChange: (String) -> Unit,
onInputClear: () -> Unit,
modifier: Modifier = Modifier,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
Expand All @@ -554,9 +567,7 @@ private fun InputFieldWithError(
trailingIcon = {
if (value.isNotEmpty()) {
IconButton(
onClick = {
// TODO
},
onClick = onInputClear,
modifier = Modifier
.padding(
top = 8.dp,
Expand Down

0 comments on commit 3f470de

Please sign in to comment.