I’m trying to figure out how to associate subcompo...
# compose
z
I’m trying to figure out how to associate subcompositions with their parent compositions in order to render them as children in the Radiography library. I’m looking for `CompositionReference`s, then using reflection to get the subcompositions that are registered with the reference and pull the slot tables out. It would be nice to have a way to do this without reflection or using the debug view attributes infra as discussed above in this thread. The more interesting problem I’m facing, however, is that there’s no way to actually tell where in the parent composition the subcomposition is being “used”. For cases like
Dialog
, the subcomposition has no associated layout in the parent composition, so that’s easy. However, for case where a particular
LayoutNode
is used as the “parent” for one or more subcompositions (e.g.
WithConstraints
,
LazyColumn
), the subcomposition is effectively a child of a particular
LayoutNode
that provides constraints for the subcompositions, and so the subcomposition should be rendered by Radiography as a child of that
LayoutNode
. Right now I’m thinking of just guessing and using some heuristic like “assume all subcompositions are “used” by the next child
LayoutNode
in the group tree traversal under the same common ancestor node”. I am really curious how yall are solving this problem for
LayoutInspector
, which I would imagine has to solve the same problem.