Skip to content

Allow to open urls by pressing them#16

Open
viesti wants to merge 1 commit intolwansbrough:masterfrom
viesti:master
Open

Allow to open urls by pressing them#16
viesti wants to merge 1 commit intolwansbrough:masterfrom
viesti:master

Conversation

@viesti
Copy link

@viesti viesti commented May 15, 2016

No description provided.

style: styles.autolink
style: styles.autolink,
onPress: function () {
Linking.openURL(node.content[0].content);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is grabbing the output text (what's in content). The link node should have a target element, and I'd recommend the following here:

Linking.openURL(SimpleMarkdown.sanitizeUrl(node.target));

which is based on https://github.com/Khan/simple-markdown/blob/master/simple-markdown.js#L1071

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it also may or may not be worth catching the error callback for Linking.openURL; I haven't used that to know how often it happens.)

It might also be useful to check for // links and change them to https:// links, as I'm not sure Linking.openURL can handle them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants