BottomSheet icon indicating copy to clipboard operation
BottomSheet copied to clipboard

add background color when BottomSheet open

Open X901 opened this issue 2 years ago • 0 comments

Hi, I think it's important to have background color on BottomSheet

I tried to add it like this

 func body(content: Content) -> some View {
        ZStack {
        content
            .onChange(of: isPresented, perform: updatePresentation)
            .onChange(of: selectedDetentIdentifier, perform: updateSelectedDetentIdentifier)
            
            if isPresented {
             Color.black.opacity(0.5).ignoresSafeArea()
                    .animation(.easeIn, value: isPresented)
            }
        }
    }

But I notice it take awhile until the background disappeared after bottomSheet closed is there a better way to do it ?

X901 avatar Feb 17 '22 07:02 X901