Hello, Androids! I have an expandable component an...
# compose
l
Hello, Androids! I have an expandable component and I need to know both the height of its expanded and collapsed states prior to the first layout. I have a semi ugly solution and I am wondering if anyone has anything more graceful! My solution essentially builds an expanded and collapsed instance of the component, measures them, returns the measurements via a callback, and then does not lay them out. If you need me to provide more details I can but the crux of the question is the first sentence: “how can I measure two different states of one component prior to the first layout”.
😶 1
j
What's your use case? Why does it need to know the height before layout? It's a quite nuanced problem so more details would be helpful
l
The variable sized component is the toolbar here:
I need these values for setting the anchors for the swipeable bottom sheet. This is obviously a bare bones toolbar but the real implementation has multiple components that animate as the toolbar expands and collapses.
The reason it should know before the first layout is so the bottom sheet can be initialized with the correct anchors
j
What bottom sheet are we talking about - is it a custom component?
l
it is a custom one!
I need four anchors