Skip to content
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

Android - Disable context menu for TextInput component #751

Open
celestk opened this issue Jan 11, 2024 · 4 comments
Open

Android - Disable context menu for TextInput component #751

celestk opened this issue Jan 11, 2024 · 4 comments

Comments

@celestk
Copy link

celestk commented Jan 11, 2024

Introduction

For ios - contextMenuHidden prop has been working perfectly fine for textInput component

For android, there is no straight-forward way to disable this context menu

Details

As above.
Many pentesting consultants have advised us to disable copy paste. using Clipboard.setString('') is now triggering this unsightly copy popup on android 13

Discussion points

Are there plans to fix this? or can someone recommend the best way to disable copy paste for android?

@tkud04
Copy link

tkud04 commented Apr 23, 2024

Co ask?

@jtstodola
Copy link

If you set pointerEvents="none" on a View surrounding the TextInput it will prevent the context menu from displaying:

<View removeClippedSubviews pointerEvents="none">
  <TextInput contextMenuHidden />
</View>

This will work for iOS, Android, and web

@Lakston
Copy link

Lakston commented Sep 25, 2024

Disabling pointer events will also prevent the keyboard from poping up on input press, which is not a viable solution

@BatDroid
Copy link

If you set pointerEvents="none" on a View surrounding the TextInput it will prevent the context menu from displaying:

<View removeClippedSubviews pointerEvents="none">
  <TextInput contextMenuHidden />
</View>

This will work for iOS, Android, and web

As mentioned, this will prevent the keyboard from showing up after user press it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants