Reputation: 2526
I am making an English Reading app. When the user clicks on a word, they will see the translation of that word.
So how to make text is selected when the user clicks and holds for some time? I desire something likes document.onselectchange
event in JavaScript for the web.
Upvotes: 1
Views: 3210
Reputation: 677
wrap the Text component with one of the available Touchable components i.e TouchableOpacity. You'll then have access to the onLongPress prop, where you can call a function which allows you to change the background color of the text to give the feel of being selected.
Upvotes: 2