PartialSheet icon indicating copy to clipboard operation
PartialSheet copied to clipboard

Simple partialSheet with type .scrollView doesn't work

Open nashfive opened this issue 1 year ago • 1 comments

I am trying a very simple dummy project to add a Scrollview in the sheet by using the PSType.scrollView as showed in the examples, but it doesn't work and even shows a UI glitch at the bottom of the sheet content while dragging.

Here is a simple app to demonstrate the issue:

import PartialSheet
import SwiftUI

@main struct PartialSheetTestsApp: App {
    var body: some Scene {
        WindowGroup {
            NavigationView { ContentView() }
                .navigationViewStyle(.stack)
                .attachPartialSheetToRoot()
        }
    }
}

struct ContentView: View {
    @State var show = false
    let type = PSType.scrollView(height: 200, showsIndicators: true)

    var body: some View {
        Button("show") { show.toggle() }
            .partialSheet(isPresented: $show, type: type, content: SheetContent.init)
    }
}

struct SheetContent: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 20) {
            HStack {
                Spacer()
                Text("Privacy Policy").font(.headline)
                Spacer()
            }
            Text("Vestibulum iaculis sagittis sem, vel hendrerit ex.").font(.body).lineLimit(2)
            Divider()
            Text("""
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vestibulum porttitor ligula quis faucibus. Maecenas auctor tincidunt maximus. Donec lectus dui, fermentum sed orci gravida, porttitor porta dui.
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vestibulum porttitor ligula quis faucibus. Maecenas auctor tincidunt maximus. Donec lectus dui, fermentum sed orci gravida, porttitor porta dui.
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vestibulum porttitor ligula quis faucibus. Maecenas auctor tincidunt maximus. Donec lectus dui, fermentum sed orci gravida, porttitor porta dui.
            """)
            Spacer().frame(height: 50)
        }
        .padding(.horizontal, 10)
    }
}

#Preview {
    NavigationView { ContentView() }.attachPartialSheetToRoot()
}

Live demo: https://github.com/AndreaMiotto/PartialSheet/assets/50933/4d0f6b84-bdf8-4f04-9c64-292465539021

Xcode 15, PartialSheet 3.1.1 Same result on Preview, simulators and devices...

nashfive avatar Oct 05 '23 16:10 nashfive

It seems that the scrollview example in the repo doesn't work either. iOS 17 broke it possibly.

nick-tw avatar Feb 21 '24 06:02 nick-tw