Nikola Despotoski
10/02/2024, 11:38 AMModifier
pass data to the grand-parent composable? I want to pass data without involving ModifierLocal
. I have custom modifier that implements ParentDataModifier
or ParentDataModifierNode
. The function that creates this modifier is belonging to a scope MyScope
.
If the composables are direct children of my custom layout composable, then I'm able to read the parentData
of the Measurable
in the layout(...) { }
block. That works fine.
This is the code when the composable is direct descendant and I'm able to read out `parentData`:
@Composable
fun MyScreen(...){
MyCustomLayout(....){ // here is MyScope context
//direct child
Button(modifier = Modifier.message("This should be read in layout phase"))
}
I want to achieve reading data from composables that indirect descendant of my custom layout composable, yet they are within MyScope
@Composable
fun MyScreen(...){
MyCustomLayout(....){ // here is MyScope context
//direct child
Box{
//indirect child
Button(modifier = Modifier.message("This should be read in layout phase"))
}
}
I also followed discussion here , that seems to have the same problem.efemoney
10/02/2024, 11:41 AMNikola Despotoski
10/03/2024, 7:59 AMMeasurable
is a single descendant that has it's own layout phase.
I'm asking if there is other way that I might have overlooked or haven't thought of.
As stated in the body, I'm trying to pass data from indirect child to a top-parent through parentData
(ParentDataModifier
)