How to display BottomSheet programmatically? #70
-
|
I am showing a BottomSheet like so: After it has been dismissed, is there a way to display it again? In other words, is there a way to display it when say, a button has been tapped? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
pavelraspaev
Jun 17, 2022
Replies: 1 comment 1 reply
-
|
Hi! You just need to set Example: Button {
withAnimation {
bottomSheetPosition = .middle
}
} label: {
Image("add")
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
}Hope it helps |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lucaszischka
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
You just need to set
var bottomSheetPositionto.middlefor open state and to.hiddenfor close stateExample:
Hope it helps