Has anyone figured out a way to animate dismissing...
# compose
j
Has anyone figured out a way to animate dismissing a BottomSheet displayed using Nav3's scene strategy programmatically? Currently, popping the display will cause the sheet to instantly disappear. Tapping outside of the sheet or tapping back dismisses the sheet w/ an animation.
a
Try to override
onRemove()
method of your
BottomSheetScene
, which goes from parent
OverlayScene
interface. And state there to hide bottom sheet -
sheetState?.hide()
j
Not sure how I’d be able to trigger the dismiss from my sheet’s composable content… I was able to achieve what I wanted using a custom composition local “provides” a lambda that my bottom sheet can invoke when it wants to dismiss itself.
a
j
I see! This is pretty elegant. I may swap my CompositionLocal solution for this… I wonder why they Nav3 project doesn’t use this example.
1
c
@Jonathan maybe file an issue on nav3 recipes to see if they can add this. i can see this coming in handy in the future for me