Aditya Wasan
05/31/2021, 3:12 PMText composables in a column. Just wanted to know if it's a bug or intended behavior.
Column {
Text("Hello")
Text("Compose")
}Aditya Wasan
05/31/2021, 3:14 PMOleksandr Karpovich [JB]
05/31/2021, 3:31 PM[JB] Shagen
05/31/2021, 3:34 PMdarkmoon_uk
06/08/2021, 12:23 AMdarkmoon_uk
06/10/2021, 2:45 AM0.5.0-build222 release 😢louiscad
06/15/2021, 8:17 PMlouiscad
06/15/2021, 9:10 PMText(…) composable seems to be added as bare text, being effectively concatenated in the DOM.
To fix that, you need to wrap the Text(…) into something, like a plain Box { … }. That will ensure the text passed to Text(…) is inside an html element and treated individually in the DOM.
FYI, the same behavior happens when Column is replaced with Div. For Div, it's less suprising since it's the expected behavior of the DOM, so I agree that Column or Text should get a solution for that at some point.louiscad
06/15/2021, 10:11 PMBox { … } workaround doesn't work for Row { … }, that said.
Does anyone know how to make an equivalent on my own?
Also, should I open an issue for that one?louiscad
06/15/2021, 11:15 PMDiv({ style { display(DisplayStyle.Flex) } }) { … } in place Row { … } seems to work.Aditya Wasan
06/20/2021, 3:44 PMColumn we can do the same, by just adding FlexDirection.Column
@Composable
fun CustomColumn(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
Div({
style {
display(DisplayStyle.Flex)
flexDirection(FlexDirection.Column)
}
}) {
content()
}
}