This commit is contained in:
Diego Mello 2017-12-04 09:51:17 -02:00
parent caf0f2354c
commit 74c0914517
1 changed files with 9 additions and 1 deletions

View File

@ -57,6 +57,14 @@ const onPress = (attachment) => {
}
Linking.openURL(attachment.title_link || attachment.author_link);
};
// Support <http://link|Text>
const formatText = text =>
text.replace(
new RegExp('(?:<|<)((?:https|http):\\/\\/[^\\|]+)\\|(.+?)(?=>|>)(?:>|>)', 'gm'),
(match, url, title) => `[${ title }](${ url })`
);
const Reply = ({ attachment, timeFormat }) => {
if (!attachment) {
return null;
@ -86,7 +94,7 @@ const Reply = ({ attachment, timeFormat }) => {
};
const renderText = () => (
attachment.text ? <Markdown msg={attachment.text} /> : null
attachment.text ? <Markdown msg={formatText(attachment.text)} /> : null
);
const renderFields = () => {