1

I want to disable clipboard(copy/paste) in my react-native app

contextMenuHidden={true} didn't work for me.

Amartya
  • 251
  • 1
  • 15

2 Answers2

3

Attaching below snippet that worked for me

removeClippedSubviews={true} contextMenuHidden={true} onFocus={() => Clipboard.setString('')} onSelectionChange={() => Clipboard.setString('')}

<View removeClippedSubviews={true}>
                            <TextInput
                              contextMenuHidden={true}
                                onFocus={() => Clipboard.setString('')} 
                                onSelectionChange={() => Clipboard.setString('')}
                                style={styles.searchInput}
                                onChangeText={this.handleSearch}
                                value={search} />
                              </View>
Amartya
  • 251
  • 1
  • 15
1

Clipboard use mostly in TextInput fields. you can refer to this post for disabling the clipboard for TextInput
Disable clipboard for TextInput in react native

Uzair
  • 61
  • 7
  • onFocus={() => Clipboard.setString('')} onSelectionChange={() => Clipboard.setString('')}. This snippet working incase of copy, also want to disable paste option – Amartya Apr 22 '21 at 17:45
  • try this: [Link](https://stackoverflow.com/a/58521318/8116260) – Uzair Apr 22 '21 at 18:17