Chris Fillmore
02/09/2022, 12:14 PMpopBackStack()
? (or if the user clicks the back button, or clicks on something that calls navigate()
)
Currently the animation only plays if the user clicks on the scrim or drags the sheet down.Chris Fillmore
02/09/2022, 12:16 PMModalBottomSheetState
and BottomSheetNavigator
but I have the notion that’s not recommendedChris Fillmore
02/09/2022, 12:21 PMval modalBottomSheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
skipHalfExpanded = true,
)
val bottomSheetNavigator = remember(modalBottomSheetState) {
BottomSheetNavigator(sheetState = modalBottomSheetState)
}
Then I could just call hide()
on the sheet statejossiwolf
02/09/2022, 1:54 PMhide
call will be cancelled when we update the sheet's content to be empty. Using snapTo
means that the state will pretty much instantly snap to the requested anchor, resulting in no animation. Ideally, we'd be hiding the sheet first and then changing the content; I'll try to put up a PR. There's also an open issue in the Accompanist repo đŸ™‚jossiwolf
02/09/2022, 2:11 PMhide
there's a good chance that the navigator and the sheet state get out of sync. That constructor will be made internal soon, too.