Disable options in text input

I use TextInput for the project and would like to DISABLE any kind of text selection or actions like (cut / copy / paste / share) as shown in the screenshot below.

I can not find anything in the official official response documentation

enter image description here

+7
javascript reactjs react-native textinput
source share
5 answers

You must add 2 selectTextOnFocus and editable attributes

For example:

 <TextInput editable={false} selectTextOnFocus={false} /> 
+6
source share

Just enter your text in the attribute editable={false}

+4
source share

Set pointerEvents none for the parent View of TextInput to disable touch events, consider the following example:

 <View pointerEvents="none"> <TextInput ... /> </View> 
+4
source share

Use caretHidden = {true} if you want to disable all operations, such as Cut Paste Copy. It will also hide your cursor.

+1
source share

contextMenuHidden - disconnect the user from inserting text into certain fields and hide the context menu. This property is added to the reaction-native 0.53

 <TextInput contextMenuHidden={true} /> 

Check PR here: Add option to hide context menu for TextInput

+1
source share

All Articles