https://kotlinlang.org logo
a

amar_1995

02/25/2020, 8:20 AM
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

Leland Richardson [G]

02/25/2020, 8:29 AM
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

amar_1995

02/25/2020, 8:40 AM
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
4 Views