Peter
12/14/2023, 7:50 PMText(text = heightPx.toString())
.Pablichjenkov
12/14/2023, 7:55 PMShahzad Ansari
12/14/2023, 7:56 PMonSizeChanged()
and onGloballyPositioned{}
modifier extensions.Peter
12/14/2023, 8:21 PMSubcomposeLayout
maybe?Pablichjenkov
12/14/2023, 8:38 PMPeter
12/14/2023, 8:53 PMLayout
, I would need some sort of state for height.
var height by remember { MutableStateOf(0f)}
So when I measure the height of my element, I would update value of the height, which will in turn recompose and display height value to Text
?Pablichjenkov
12/14/2023, 9:18 PMPeter
12/14/2023, 9:35 PMPablichjenkov
12/14/2023, 9:44 PMPablichjenkov
12/14/2023, 9:45 PMPablichjenkov
12/14/2023, 9:47 PMPablichjenkov
12/14/2023, 9:49 PMZach Klippenstein (he/him) [MOD]
12/14/2023, 9:51 PMPablichjenkov
12/14/2023, 9:52 PMZach Klippenstein (he/him) [MOD]
12/14/2023, 9:53 PMZach Klippenstein (he/him) [MOD]
12/14/2023, 9:53 PMPeter
12/14/2023, 10:02 PMLayout
will pass twice, I was wondering if it might be same performant as SubcomposeLayout
Zach Klippenstein (he/him) [MOD]
12/14/2023, 11:56 PMLayout
approach may cause an extra frame than would otherwise be necessary, but it would only do it when the size changes. SubcomposeLayout
has an ongoing cost for the bookkeeping required to manage a whole separate composition.Peter
12/15/2023, 9:07 AM