For my case, I show ModalBottomSheetLayout
, click on an item to perform compose navigation to another screen. When I returned to the current screen, ocassionally I get IllegalArgumentException
(not everytime). I suspect I modified the data, which caused compose render in ModalBottomSheetLayout
and cause the error (maybe a bug).
I try to set a min height but it doesn't seems to work.
val modalBottomSheetState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)ModalBottomSheetLayout( sheetState = modalBottomSheetState, sheetContent = { val albums by viewModel.albumsFlow.collectAsState(initial = emptyList()) Box( Modifier .fillMaxWidth() .defaultMinSize(minHeight = 100.dp)) { // content } })
My final solution is call modalBottomSheetState.hide()
before I navigate away, so that ModalBottomSheetLayout
is hidden when returned.