The `OnChildPositionedModifier` seems surprising t...
# compose
z
The
OnChildPositionedModifier
seems surprising to me. Given that a node can have any number of children, I'm glad the kdoc calls out that the callback will be invoked once for every child. But it would seem a lot more intuitive (and more consistent with the
Layout
composable) to invoke the callback once per layout pass, and instead pass in the list of
LayoutCoordinates
corresponding to all the children laid out in that pass. The current API makes it difficult to determine if two given callback invocations correspond to two siblings in the same pass or the same child in subsequent passes. What's the reasoning behind this API design?
l
cc @Mihai Popa ^ pretty good point, IMO. Though, to be clear, this would have also been a valid argument against the previous composable API, correct?
👍 1
this API might also be more useful if you had all of the children at once
what are the use cases we’ve had for this API? I don’t even know
m
@Andrey Kulikov @George Mount
z
Yes, had this question about the previous API too since it had the same contract.
a
yes, this modifier was more reasonable in the previous form of a Composable functions, basically what you wrapped was being positioned. as a modifier it can be less useful in general. maybe instead we will have only OnPositioned, but from the LayoutCoordinates object you will be possible to get the list of children LayoutCoordinates. I will create a bug for myself to explore. now it is on a stage of more literal migration from composables to modifiers. thanks for the feedback!
z
Sounds good!