Getting the value of highlighted/marked text - react-native

I'm really new to React Native (but quite experienced in React) and i'm having some issues with my react native app and was hoping to get some help.
What i'm trying to achieve is that I want to be able to select and highlight a word in a text, then store that value in a variable.
In native javascript to retrive the word would be something like "window.getSelection()", but that obviously doesnt work in this case. At the moment I have only found solutions using TextInput, but I want the text to be static.
Anyone have any suggestions how to tackle this problem?
Thank you in advance

Use <TextInput> with a editable={false}
UPDATE
As far as I know, there is no way to get the highlighted string directly but you can handle this with a trick!
use a setInterval and call Clipboard.getString() to get the string that is copied to clipboard!
ref1 - ref2

Related

rendering different screen based on input by the user React Native

Hello fellow programmers, i wanted to ask how can i achieve different screen rendering based on input by the user. I have done it in one way but i want to know is there any better way to do?
Attached is the link to snack on expo. You can run it and see the code of how i have done it.
If there are better alternates, please let me know.
Thankyou.
please dont mark the question as duplicate before going throught it.
For better choice you can using react-navigation https://reactnavigation.org/docs/auth-flow/ This package work in Expo
The example you posted looks mostly like something I would use conditional rendering techniques for like the && syntax
See here for more guidance:
https://reactjs.org/docs/conditional-rendering.html
If your pages are dramatically different though (not just options flipping on and off) then I would recommend react navigation as giri commented.

Connecting two buttons with a line in react native

I want to join two points with a line for a quiz I'm doing. I'm really new to react native and I don't really understand how to use the PanResponder (that's what I think I should use in order to get the result I expect).
I attach here the image of what I want to do as follows.
I appreciate any help!
Here is one way to do it, with a bit of creativity it can be automated
https://snack.expo.io/#rynek/hazardous-crackers

Custom input box styling in react-native-elements

Being new to react-native, I am trying to style my input fields using react-native-elements to look similar to their example ones (Example).
Even after going through the source code for the example I still can't seem to figure out where I would start when it comes to customizing these fields to that extent.
As a heads up for anyone else looking to do the same thing, I ended up using this library to make nicer looking animated input fields. It isn't quite the same as what I had originally planned, but if you're in the same scenario as I was, I definitely recommend taking a look.

React Native | text highlighting

I am working on a react native app.
in one page of it I wan't to make a highlighting option like the following picture
but I can't customize the text popover to reach this behavior,
after many trials I reached the following result
Any idea how to add highlighting functionality?
Try using react-native-highlight-words library . Might be it solves your problem
Just use a webview and use the injectedJavaScript prop

React native tree select component

I tried to find tree view select in react native, But, I couldn't find any. I also tried to generate my own, but it will take more time to develop and need to fix many things that I can't do right now.
Can anybody provide inputs on which library or component use for tree multi-select inputs?
Thank you in advance.