https://kotlinlang.org logo
#compose
Title
# compose
e

eygraber

02/27/2023, 6:03 PM
Is there any way to force the
composition
field of a
TextField's
TextFieldValue
to be null? If I always set it to null, then after I change the text an infinite recomposition starts (assuming because the internal state of
composition
is not
null
and is calling
onValueChange
until it matches)
s

Siyamed

03/01/2023, 5:26 PM
why do you want to force it to be null?
e

eygraber

03/01/2023, 5:28 PM
We're using a
BasicTextField
with a custom decoration to make it look like separate boxes per character (for a pin entry) and we don't want any composition applied to it.
s

Siyamed

03/01/2023, 6:10 PM
composition was not intended to be changed but to inform. it will break the assumptions of both TextField but more importantly the keyboard. Not sure if there is a workaround for that at the moment. Not sure what you mean "per character" but if it is not digits, then the definition of "character" as commonly known is wildly different per language.
it is better to filter your text or how it looks rather than resetting composition.
e

eygraber

03/01/2023, 6:28 PM
By per character I mean per ASCII alphanumeric character, and that's unlikely to ever change for this particular feature
6 Views