diff --git a/app/containers/message/Reply.js b/app/containers/message/Reply.js index 36c55adc7..621c409e9 100644 --- a/app/containers/message/Reply.js +++ b/app/containers/message/Reply.js @@ -30,6 +30,11 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'center' }, + author: { + fontWeight: 'bold', + marginHorizontal: 5, + flex: 1 + }, time: { fontSize: 10, fontWeight: 'normal', @@ -57,6 +62,14 @@ const onPress = (attachment) => { } Linking.openURL(attachment.title_link || attachment.author_link); }; + +// Support +const formatText = text => + text.replace( + new RegExp('(?:<|<)((?:https|http):\\/\\/[^\\|]+)\\|(.+?)(?=>|>)(?:>|>)', 'gm'), + (match, url, title) => `[${ title }](${ url })` + ); + const Reply = ({ attachment, timeFormat }) => { if (!attachment) { return null; @@ -68,7 +81,6 @@ const Reply = ({ attachment, timeFormat }) => { } return ( { }; const renderAuthor = () => ( - attachment.author_name ? {attachment.author_name} : null + attachment.author_name ? {attachment.author_name} : null ); const renderTime = () => { @@ -85,8 +97,21 @@ const Reply = ({ attachment, timeFormat }) => { return time ? { time } : null; }; + const renderTitle = () => { + if (!(attachment.author_icon || attachment.author_name || attachment.ts)) { + return null; + } + return ( + + {renderAvatar()} + {renderAuthor()} + {renderTime()} + + ); + }; + const renderText = () => ( - attachment.text ? : null + attachment.text ? : null ); const renderFields = () => { @@ -113,11 +138,7 @@ const Reply = ({ attachment, timeFormat }) => { > - - - {renderAvatar()}   {renderAuthor()} {renderTime()} - - + {renderTitle()} {renderText()} {renderFields()} {attachment.attachments.map(attach => )}