I have an app where I'm using react-native webview to display a document.
The user can select some text and perform some custom action that I provide.
How do I get the selection object from webview into my app?
From 0.37.0 onwards there is a new feature in RN that might help you. There is a new prop in the
WebView: onMessage and also a new method,
postMessage that enable two-way communication. From the WebView, you have to call
window.postMessage, and it will invoke the function that you define as callback for
onMessage. You can see a full example in the documentation. As for getting the selected text, check out this answer.