Nested <Text> clicks
See original GitHub issueHey.
I want to render some hypertext, e.g
var hypertext = 'this is <a href="http://facebook.com">facebook.com</a> link';
I tried programmatically splitting into
<Text>
<Text>this is </Text>
<Text onPress={this.onLinkPress} style={{color: '#0000ff'}}>facebook.com</Text>
<Text> link</Text>
</Text>
but obviously onPress
wouldn’t work, because nested text is transformed.
- Should a message be thrown if
onPress
is being set on the nested text? - Is there any good way to get a click handler on the link?
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Why are 2 clicks necessary to edit a text field which is placed ...
When you click the first time the cell is editable and you are alreadyediting the cell. The coach of course does not know...
Read more >How to click a div with certain text in a nested div using cypress?
I'd like to click on the div with the class box containing the <a>link2</a> tag. I have tried this : cy.get(`.main>div`).contains('link2').
Read more >Conquer nested elements clicks tracking in GTM - Medium
Conquer nested elements clicks tracking in GTM ... Usually, analytics events/hits are tied to some element's click based on ... Text to speech....
Read more >Format lists in Keynote on Mac - Apple Support
Select the text you want to format. In the Format sidebar, click the Text tab, then click the Style button near the top...
Read more >Add bullets or numbers to text - Microsoft Support
Nested lists (you can press Tab or click Increase List Level Increase Indent button to create the same effect, but a new indented...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I know this is an old issue, but stumbled across it today after getting an error:
views nested within a <Text> must have a width and height
I got this from trying to insert a
<TouchableOpacity>
inside a text component. Like @brentvatne suggested.For me, the correct solution was a mix of your two answers:
Ok, thanks everyone, this actually works fine, I was just passing wrong
this
😩 Made a small module as a result https://github.com/agentcooper/react-native-hypertext