Adrian Landborn
10/02/2024, 8:35 AMmodifier.semantics(mergeDescendants = true)
is set?
I am facing a problem where the inner components (children) have a custom Talback order and uses `mergeDescendants`in some cases to merge chunks of texts and other content. But in some cases I want to override this behaviour by using mergeDescendants = true
in a parent composable.
@Composable
fun ItemWithBorder(modifier: Modifier = Modifier.semantics(mergeDescendants = true) {}) { // `mergeDescendants = true` is set from an outer function
// Parent
Column(
modifier
.border(BorderStroke(1.dp, Color.Black))
.padding(16.dp)) {
// Child
Column(Modifier.semantics(true) { }) { // `true` here will override the parent nodes `mergeDescendants = true`
Text(text = "Text 1")
Text(text = "Text 2")
}
// Child
Column(Modifier.semantics(true) { }) { // `true` here will override the parent nodes `mergeDescendants = true`
Text(text = "Text 3")
Text(text = "Text 4")
}
}
}
Any ideas?Adrian Landborn
10/02/2024, 8:36 AM