Skip to content

"SuppressesLongPressGesture" in Capacitor #3208

Discussion options

You must be logged in to vote

If anyone else is looking for that, I've found a solution by adding custom native code:

@objc(suppressLongpressGesture:)
func suppressLongpressGesture(call: CAPPluginCall) {
    // get WKWebView
    let webView = self.bridge.getWebView();
    // recognize long-press gesture to prevent haptic feedback (selection start, standard behavior in Safari)
    let recognizeLongPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongpressGesture))
    recognizeLongPressGesture.minimumPressDuration = 0.45;
    recognizeLongPressGesture.allowableMovement = 100.0;
    // add this in main thread
      DispatchQueue.main.async {
        // add gesture recognizer from above
 …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Nikita-schetko
Comment options

@Nikita-schetko
Comment options

@derbenoo
Comment options

@vojto
Comment options

@iwhcto
Comment options

Answer selected by christianhengst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants