【发布时间】:2021-07-16 21:46:45
【问题描述】:
我想在我的 react-native 应用中禁用剪贴板(复制/粘贴)
contextMenuHidden={true} 对我不起作用。
【问题讨论】:
标签: android react-native clipboard textinput
我想在我的 react-native 应用中禁用剪贴板(复制/粘贴)
contextMenuHidden={true} 对我不起作用。
【问题讨论】:
标签: android react-native clipboard textinput
附加在对我有用的 sn-p 下方
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>
【讨论】:
剪贴板主要用于TextInput 字段。你可以参考这篇文章来禁用TextInput的剪贴板
Disable clipboard for TextInput in react native
【讨论】: