Hey folks, got this issue where I compose some UI based on a model which shows either
TextInput
or
Text
when I double click on the text it turns the
Text
into a
TextInput
in the compose tree
@Composable
private fun Text(
element: TextElement,
inEdit: Boolean = false
) {
val textStyle = TextStyle(
background = Color.Transparent,
fontWeight = element.fontWeight,
fontSize = TextUnit.Em(element.fontSize),
color = element.color
)
val spacing =
Spacing(element.spacingLeft.dp, element.spacingTop.dp, element.spacingRight.dp, element.spacingBottom.dp)
if (inEdit) {
TextField(modifier = spacing, value = element.text, textStyle = textStyle, onValueChange = {
element.text = it
})
} else {
Text(modifier = spacing, text = element.text, style = textStyle)
}
}
It seems that even though
Text
is being displayed Compose is still receiving text input via the missing
TextInput
(see video) possibly.. I would expect that if a recompose occurs then it would not exist in this part of the compose graph anymore 🤔 any ideas?