lucaszischka/BottomSheet

How can I close it to open another one ?

Closed this issue · 1 comments

X901 commented

Hi,

Awesome library !

I have Button inside bottomsheet
when I click on it I need to close the corrent bottomsheet and open different bottomsheet
when I close the newest bottomsheet, I want to return to the first bottomsheet

I notice you didn't have a boolean value so I didn't know how can I do this scenario

Im not quite sure what you want to do. A code snipped would be great next time. Also this is not a issue but a question. Converting to discussion.

However I think this is what you want:

@State var bottomSheetPosition1: Bool = .relative(0.4)
@State var bottomSheetPosition2: Bool = .hidden

var body: some View {
    // Your view
    .bottomSheet(bottomSheetPosition: self.$bottomSheetPosition1, )
    .bottomSheet(bottomSheetPosition: self.$bottomSheetPosition2, )
}

func yourButton() -> Void {
    // Close one sheet 
    self.bottomSheetPosition1 = .hidden
    // Open the other one
    self.bottomSheetPosition2 = .relative(0.6)
}