I am trying to make some portion of text of different color and clickable
Here is my code:
<Text style = {styles.term_service}>By signing up, you agree to Terms of Service and Privacy Policy.</Text>
I want to make Terms of Service and Privacy Policy clickable and have different color.
To set text color in React, we can set the style prop to an object with the color property. to set the style prop of the h1 element to an object that has the color property set to 'red' . Now we should see that the color of the text is red.
To insert a line break into a Text component in React Native, we can add the '\n' character string. to add {'\n'} into the content of Text .
Use inline styles to bold specific text in React. js, e.g. <span style={{fontWeight: 'bold'}}>world</span> . The bold font will only be applied to the element to which it was added and its children.
you can use nested text doc also Text
accept onPress
doc
<Text style = {styles.term_service}>By signing up, you agree to Terms of Service and <Text onPress={()=> someAction()} style = {{ color: '#fff' }}>Privacy Policy.</Text></Text>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With