paololeonardi / WaterfallGrid

A waterfall grid layout view for SwiftUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LongPressGesture Gestures conflict

UnrealCherry opened this issue · comments

WaterfallGrid((0..<30), id: .self) { index in
CategoryBook().gesture(LongPressGesture(minimumDuration: 0.5, maximumDistance: 1).onEnded{ v in
self.previewShow = true
})
}

use LongPressGesture can't scroll

looks like something related to the ScrollView.
A similar question was asked here: https://stackoverflow.com/questions/62733633/swiftui-tapgesture-and-longpressgesture-in-scrollview-with-tap-indication-not-wo

Try adding a TapGesture recognizer:

WaterfallGrid((0..<30), id: .self) { index in
CategoryBook()
  .onTapGesture {}
  .onLongPressGesture(minimumDuration: 0.5, maximumDistance: 1, perform: {
    self.previewShow = true
  })
}