Posts

Post not yet marked as solved
0 Replies
526 Views
Hi everyone, I have a problem when adding a CustomView(), which has a DragGesture() and .onTapGesture(_:), and its inside an ScrollView. On tap, this CustomView expands and takes the whole screen, and when you Drag it, it should allow you to do some visual customs and if you drag that much, it would go back to its previous state. Seems pretty easy but my problem is that the drag event of the ScrollView is overriding the drag of the CustomView inside of it, thus, making some weird behaviour. If I disable the scroll at all, the drag gesture of the CustomView works just fine. Ex: ScrollView([], showsIndicators: false) { // List of CustomViews } But I'd like for the ScrollView to be scrollable if my CustomView is not expanded, and to disable the scrolling if that CustomView is expanded. I tried the following but it didn't work: ScrollView(active ? [] : .vertical, showsIndicators: !active) { // List of CustomViews } Being active my state var for when a CustomViews has been expanded. It seems like after the ScrollView has been set that it can be scrollable once, it'll ignore any further instruction that says otherwise. I've read on the forum that someone recommended to use a library called Instrospect - https://github.com/siteline/SwiftUI-Introspect but I would really like to use a native solution instead of relying on thirds' libraries.
Posted Last updated
.