lucaszischka/BottomSheet

Main content appear when scroll begin

Opened this issue · 0 comments

Describe the bug
MainContent appear during scroll

Minimal reproduce-able code

struct ContentView: View {
    
    @State private var region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))
    @State var bottomSheetPosition: BottomSheetPosition = .absoluteBottom(300) //1
    
    var body: some View {
        map()
            .ignoresSafeArea()
            .bottomSheet(bottomSheetPosition: $bottomSheetPosition,
                         switchablePositions: [.dynamicTop, .absoluteBottom(300)],
                         headerContent: header,
                         mainContent: list)
            .dragIndicatorColor(Color.gray)
            .customBackground(Color.white.cornerRadius(20))
    }
    
    func header() -> some View {
        Text("Head")
            .font(.title3)
            .frame(height: 50)
            .frame(maxWidth: .infinity)
            .background(Color.red)
    }
    
    func map() -> some View {
        Map(coordinateRegion: $region)
    }
    
    func list() -> some View {
            List(0..<200) { item in
                Text("Item \(item)")
            }
            .listStyle(.plain)
    }
}

Expected behavior
Main content should be visible on initial state.

Screenshots

RPReplay_Final1717088953.MP4