How to close keyboard when imeActionPerformed.
# compose
a
How to close keyboard when imeActionPerformed.
When I am passing calling
ContextAmbient.current
inside
onImeActionPerformed
it throws
Functions which invoke @Composable functions must be marked with the @Composable annotation
error
l
current
of an ambient can only be called in a composable function. You’re trying to do it in a lambda of a callback. Instead, call it in the composable and cache it in a variable, and then use the variable in the lambda.
👍 1
a
Copy code
customTextFeild(
	hint = HINT,
	value = value.value,
	onValueChange = { value.value = it },
	modifier = LayoutFlexible(1f) + LayoutGravity.Center + LayoutPadding(
		left = 8.dp,
		right = 8.dp
	),
	onImeClickPerformed = {
		context
		onSearchClick(value.value)

	}
)
Like this 👆
👍🏻 1