LongPressGesture Gestures conflict
UnrealCherry opened this issue · comments
UnrealCherry commented
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
Paolo Leonardi commented
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
})
}