-
Notifications
You must be signed in to change notification settings - Fork 82
Description
I'm trying to use autolink to render linkable text and allow clicking on URLs. Out of the box it works well, but when I set selectable={true}, I lose the clickability (you can copy and paste the link text, but clicking doesn't do anything). I've tried a couple of different tricks (making only the text selectable? trying to re-implement openURL in onPress), but these don't work either. It seems to be EITHER clickable links OR selectable text, not both.
By default, this doesn't allow selecting/copying/pasting, but links work without any custom onPress
<Autolink style={styles.subject} text={notification.subject} />
<Autolink style={styles.subject} text={notification.subject} textProps={{ selectable: true }} />
This allows selecting/copying/pasting, also highlights the URL's I want to be clickable, but they're not.
<Autolink style={styles.subject} text={notification.subject} selectable={true} />
This is just a flail that will clickable links, but plain text not selectable (even though it's explicitly specified true):
<Autolink style={styles.subject} text={notification.subject} textProps={{ selectable: true }} onPress={(url) => { Linking.openURL(url); }} />
This is another stab at it that that results in selectable but not clickable links (basically the base behavior with selectable={true}):
<Autolink style={styles.subject} text={notification.subject} selectable={true} onPress={(url) => { Linking.openURL(url); }} />
Is that working as designed or should I be able to get clickable and highlightable text (the way hypertext works on a browser)?