I'm a new react-native developer. I want to get the value of Text component using onPress and pass it to a function.
<Text onPress={()=>this.display}>Hello World</Text>
display= (text) =>{
console.log(text);//this should print Hello world
}
This method can be used to get text from a text onPress event
<Text onPress={(event) => console.log(event._dispatchInstances.memoizedProps.children)} >{value}</Text>