Tgo1014
09/17/2024, 11:56 AMcompact: @Composable () -> Unit
, and sometimes it can not render anything:
compact = {
uiModel?: return@ContentFadeBottomSheet
MyComposable(uiModel)
}
Is there a way to know that the compact()
changed (when uiModel is not null anymore) so I can remeasure the height? I tried to use key(compact)
but didn’t workStylianos Gakis
09/17/2024, 1:49 PMBox(Modifier.onPlaced { storeSizeHere }) {
compact()
}
on the function which receives the lambda, does it do what you want?Zach Klippenstein (he/him) [MOD]
09/17/2024, 4:01 PMcompact
should recompose when uiModel
changes automatically if uiModel
is snapshot state, and if that emits or removes layout nodes your parent should automatically remeasure. So you shouldn’t have to do anything special.Zach Klippenstein (he/him) [MOD]
09/17/2024, 4:03 PMif (uiModel != null) {
MyComposable(uiModel)
}
Tgo1014
09/18/2024, 9:24 AMif
also didn’t work. In the end I used some other flag based in the uiModel not being null to trigger a key(isShowing)
so it would recalculate what I needed, not sure if it’s ideal but it works 😬Zach Klippenstein (he/him) [MOD]
09/18/2024, 5:21 PMuiModel
coming from?