diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/comments/CommentTile.tsx | 7 | ||||
-rw-r--r-- | src/utils/comments.tsx | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/components/comments/CommentTile.tsx b/src/components/comments/CommentTile.tsx index 37a249a8..12f32c95 100644 --- a/src/components/comments/CommentTile.tsx +++ b/src/components/comments/CommentTile.tsx @@ -14,7 +14,7 @@ import {deleteComment, getCommentsCount} from '../../services'; import {RootState} from '../../store/rootReducer'; import {CommentThreadType, CommentType, ScreenType} from '../../types'; import {getTimePosted, normalize, SCREEN_WIDTH} from '../../utils'; -import {mentionPartTypes, renderValue} from '../../utils/comments'; +import {mentionPartTypes, renderTextWithMentions} from '../../utils/comments'; import {ProfilePreview} from '../profile'; import CommentsContainer from './CommentsContainer'; @@ -136,7 +136,10 @@ const CommentTile: React.FC<CommentTileProps> = ({ /> <TouchableOpacity style={styles.body} onPress={toggleAddComment}> <View style={styles.comment}> - {renderValue(commentObject.comment, mentionPartTypes)} + {renderTextWithMentions({ + value: commentObject.comment, + partTypes: mentionPartTypes, + })} </View> <View style={styles.clockIconAndTime}> <ClockIcon style={styles.clockIcon} /> diff --git a/src/utils/comments.tsx b/src/utils/comments.tsx index a1f353d6..c0b522f2 100644 --- a/src/utils/comments.tsx +++ b/src/utils/comments.tsx @@ -43,6 +43,11 @@ const renderPart = (part: Part, index: number) => { ); }; +interface RenderProps { + value: string; + partTypes: PartType[]; +} + /** * Value renderer. Parsing value to parts array and then mapping the array using 'renderPart' * @@ -51,7 +56,10 @@ const renderPart = (part: Part, index: number) => { * @param value - value from MentionInput * @param partTypes - the part types array that you providing to MentionInput */ -export const renderValue: React.FC = (value: string, partTypes: PartType[]) => { +export const renderTextWithMentions: React.FC<RenderProps> = ({ + value, + partTypes, +}) => { const {parts} = parseValue(value, partTypes); return <Text>{parts.map(renderPart)}</Text>; }; |