Hiya, Started migrating some of our client's TextI...
# compose-android
v
Hiya, Started migrating some of our client's TextInput components from value-based text fields to state-based text fields, but reached a dead-end when trying to make an input where the value is read verbatim (
VerbatimTTSAnnotation
). With the value-based inputs, I could could make a
VerbatimTTSAnnotation
-annotated copy of the
TextFieldValue
, which the Talkback service correctly read verbatim.
Copy code
// TTS output: "onehundred twenty three"
val value = TextFieldValue(text="123") 

// TTS output: "one two three"
val ttsAnnotatedValue = value.copy(
  annotatedString = value.text.toVerbatimTTSAnnotatedString()
)

TextField(
  value = ttsAnnotatedValue
)
Previously I was also able to apply
VerbatimTTSAnnotation
to any VisualTransformations, as the
TransformedText
worked with
AnnotatedString
. If anyone working closely with TextFields could point me in the right direction, that would be much appreciated. Leaning towards this being an oversight in the "new" API design, already started writing an Issue Tracker ticket. e: the ticket
z
Do you want to be able to add this annotation from an
OutputTransformation
? You're correct, this is an oversight in the TextFieldBuffer api. Cc @Halil Ozercan
h
cc @HaoyuZhang Annotations are not yet supported in the new TextField but we are actively working on them. OutputTransformation supports adding styling but not all the annotations supported by AnnotatedString.