I’m making a libraryish kind of app for reading.
Is there a way to get the string value from a native text selection?
To be clear, this is what I mean…
I found this Library that would have helped however it’s archived.
Since I wasn’t able to find a way around getting the text from a native selection, I opted to have each paragraph as a Touchable, which the user can then highlight however this highlights the entire block of text. Not Ideal, but It works. Screenshot of what I mean, below.
Now if what I am asking for isn’t possible, and there is no easier way… does that mean I would have to write a native module to get what I want?
Hi @oiver55, did you try setting up the selectable
prop to true on the Text
component? You might not need a third party library for this if all the content is wrapped with Text
component in your app.
Yes I did try that however the problem that arises, is that when you select text natively the native menu’s appear, however I would like to have my own UI menu. (You can see my menu in the screenshot from my first post.)
In addition to that even though I can select the text with the selectable prop set to true, I still can’t get the string-value of the selection (into javascript). The purpose for me getting the string value is so that I know what text to highlight.