Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bottom sheet blocks inner scroll/gestures #47

Closed
ValeriyJefimov opened this issue Jan 22, 2022 · 6 comments
Closed

Bottom sheet blocks inner scroll/gestures #47

ValeriyJefimov opened this issue Jan 22, 2022 · 6 comments
Labels
bug Something isn't working Thank You ❤️ For people who appreciate my work

Comments

@ValeriyJefimov
Copy link

ValeriyJefimov commented Jan 22, 2022

Hi @LucasMucGH, thanx for an awesome lib.

But I have faced a major issue on the newest build, when trying to add horizontal scroll or drag at BS content.

Sample code:

struct Content: View {
    
    @State var bottomSheetPosition: BottomSheetPosition = .bottom

    var colors: [Color] = [
        .blue, .black, .gray, .green, .orange, .pink, .yellow
    ]
    
    var scrollContent: some View {
        ScrollView(.horizontal) {
            HStack {
                ForEach(colors, id: \.self) {
                    $0.frame(width: 100)
                }
            }
        }
        .frame(height: 300)
        .padding([.trailing, .leading], 20)
    }
    
    var body: some Scene {
            scrollContent
                .bottomSheet(bottomSheetPosition: self.$bottomSheetPosition,
                             options: [.appleScrollBehavior, .noBottomPosition]) {
                    scrollContent
                }
    }
}

And video:
https://drive.google.com/file/d/1wp2V94RMepHBi6uRKhEpWE1kaOiCS-17/view?usp=sharing

On the prev version I have fixed it with just adding an option to use simultaneous gesture, but now it doesn't work.

Thanx.

@lucaszischka
Copy link
Owner

Yes DragGesture is not working at all or as expected. This issue is not caused by my libary, but instead by ScrollView itself: https://stackoverflow.com/questions/57700396/adding-a-drag-gesture-in-swiftui-to-a-view-inside-a-scrollview-blocks-the-scroll

The horizontal scroll issue is caused by the implementation of the .appleScrollBehavior option. Unfortunately there is nothing at the time I can do to fix it (as to my knowledge), because of the limitations of SwiftUI. The current approach is mainly based on buggy workarounds, because otherwise it wouldn’t work at all.
Therefore, i will probably remove the .appleScrollBehaviour soon.

So to answer your question: please remove the.appleScrollBehavior option. If the issue persist, I can reopen this, but otherwise there is nothing I can do to fix it.

@lucaszischka lucaszischka added bug Something isn't working Thank You ❤️ For people who appreciate my work wontfix This will not be worked on labels Jan 22, 2022
@ValeriyJefimov
Copy link
Author

@LucasMucGH So will you remove the ability to display content with height more than overlay's?

@lucaszischka
Copy link
Owner

No i will remove .appleScrollBehaviour. This option does the following:

  • Puts the mainContent in a ScrollView
  • Disables scroll, except in the .top position
  • When the scroll offset is < 0 the BottomSheet gets dragged down (instead of scrolling)

If you want you can still use a ScrollView and put any content inside, as before. Only the above option gets removed.

@diegorc1312
Copy link

You could use .simultaneousGesture(DragGesture())

https://developer.apple.com/documentation/swiftui/simultaneousgesture

@lucaszischka
Copy link
Owner

No .simultaneousGesture(DragGesture()) doesn't work.

Nevertheless it should be fixed in main. Please test the changes and report any other issues found, bevor I release them

@lucaszischka lucaszischka reopened this Mar 11, 2022
@lucaszischka lucaszischka removed the wontfix This will not be worked on label Mar 11, 2022
@ValeriyJefimov
Copy link
Author

@lucaszischka Can confirm, that inner scrolling is not blocked now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Thank You ❤️ For people who appreciate my work
Projects
None yet
Development

No branches or pull requests

3 participants