Colton Idle
06/11/2024, 1:38 PMscope
.launch { bottomSheetState.hide() }
.invokeOnCompletion {
if (!bottomSheetState.isVisible) {
openBottomSheet = false
}
}
why do you need that invokeOnCompletion, if a few lines above you have onDismissRequest = { openBottomSheet = false }Albert Chang
06/11/2024, 2:03 PMonDismissRequest is what ModalBottomSheet calls after hiding the sheet with animation. If you just update the state without calling bottomSheetState.hide(), the sheet will be immediately dismissed without animation. That’s why you need the snippet if you want to hide the sheet yourself with animation.Colton Idle
06/11/2024, 2:23 PMColton Idle
06/11/2024, 2:24 PMAlbert Chang
06/11/2024, 2:27 PMonDismissRequest is only called when the sheet is dismissed by gesture or back key.Colton Idle
06/11/2024, 2:29 PMColton Idle
06/11/2024, 2:29 PMColton Idle
06/11/2024, 2:30 PMTolriq
06/11/2024, 3:17 PMyoussef hachicha
06/11/2024, 3:27 PMColton Idle
06/11/2024, 3:45 PMTolriq
06/11/2024, 3:46 PMColton Idle
09/16/2024, 6:15 PMyoussef hachicha
09/18/2024, 6:14 PMColton Idle
09/18/2024, 6:37 PMjossiwolf
09/19/2024, 9:01 AMColton Idle
09/19/2024, 1:34 PMif (openBottomSheet) { but... yeah. then i feel like i have two states to represent the same thing.Colton Idle
09/19/2024, 3:41 PMjossiwolf
09/19/2024, 4:34 PMshow?Colton Idle
09/19/2024, 6:21 PMif (sheetState.isVisible) and after you dismissed the sheet (by clicking outside the sheet) then it would dismiss. but you cant bring it up again.jossiwolf
09/25/2024, 7:40 AMColton Idle
09/25/2024, 1:03 PM