Othman El Jazouli
02/21/2023, 4:53 PMBottomSheet
that has a list of items to show, the list comes from a MVI ViewModel
the issue is the bottomsheet is not showing, viewState.items
returns an empty list as initial state before getting the real list with n items
-if I hardcode the list to a list initially it’s fine
-if I give the Column
a specific height it’s fine
not sure why it doesn’t show when the list is dynamic, any tips?
does the bottomsheet have problems showing if the content height is changing when the height is undefined?
@Composable
fun BottomSheetContent(
viewModel: ItemViewModel = getViewModel()
) {
val viewState: ItemViewState by viewModel.viewState.collectAsStateLifecycleAware()
// vm intent call
BottomSheetScreen(items = viewState.items)
}
@Composable
private fun BottomSheetScreen(items: List<Item>) {
Column(modifier = Modifier.fillMaxWidth()) { //.height(150.dp) works
SheetHeader(title = "title")
items.forEach { item ->
ItemContent(item)
}
}
}
to clarify the bottomsheet is added from NavHost
addDestination(
BottomSheetNavigator.Destination(
provider[BottomSheetNavigator::class],
content
).apply {
this.route = navigationEvent.route
}
)
dorche
02/21/2023, 5:12 PMIan Lake
02/21/2023, 5:15 PMOthman El Jazouli
02/21/2023, 5:30 PMOthman El Jazouli
02/21/2023, 5:30 PMjossiwolf
02/21/2023, 9:49 PM