Skip to content

disable long press #2238

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

Closed
JacksenLaw opened this issue Nov 17, 2021 · 5 comments
Closed

disable long press #2238

JacksenLaw opened this issue Nov 17, 2021 · 5 comments
Labels
Stale Type: feature request New feature or request

Comments

@JacksenLaw
Copy link

Because the bottom line will automatically select some text,so,Can you provide a way to disable the long press event?

@JacksenLaw JacksenLaw added the Type: feature request New feature or request label Nov 17, 2021
@gbhrdt
Copy link

gbhrdt commented Nov 19, 2021

You can solve it with some custom CSS:

const customCss = '* { -webkit-user-select: none; } input, textarea { -webkit-user-select: initial; } body { user-select: none !important; overflow-x: hidden !important; }';

const customJs = `
      (function() {
        setTimeout(function() {
          try {
            var s = document.createElement('style');
            s.innerHTML = '${customCss.replace(/'/g, "\\'").replace(/(\r\n|\n|\r)/gm, '')}';
            document.head.appendChild(s);
          } catch (e) {  }
        }, 0); 
      })();`;

<WebView
  injectedJavaScriptBeforeContentLoaded={Platform.OS === 'ios' ? customJs : undefined}
  injectedJavaScript={Platform.OS === 'android' ? customJs : undefined}
...
/>

@github-actions
Copy link

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@chriswgreen-lineup
Copy link

Had a similar issue rendering a custom canvas within a webview and getting the copy prompt on long hold. Solution for me was to simply insert the following within the styles of the rendered html.

  • {
    -webkit-user-select: none;
    }

@rohit75
Copy link

rohit75 commented Aug 23, 2022

Had a similar issue rendering a custom canvas within a webview and getting the copy prompt on long hold. Solution for me was to simply insert the following within the styles of the rendered html.

  • {
    -webkit-user-select: none;
    }

Can you please explain where to add this code? @chriswgreen-lineup

@nabi-ebrahimi
Copy link

Had a similar issue rendering a custom canvas within a webview and getting the copy prompt on long hold. Solution for me was to simply insert the following within the styles of the rendered html.

  • {
    -webkit-user-select: none;
    }

Could you please describe where should we add this styles?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants