diff options
Diffstat (limited to 'src/utils/comments.tsx')
-rw-r--r-- | src/utils/comments.tsx | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/utils/comments.tsx b/src/utils/comments.tsx index a71e3857..0d551682 100644 --- a/src/utils/comments.tsx +++ b/src/utils/comments.tsx @@ -55,6 +55,7 @@ const renderPart = ( interface RenderProps { value: string; styles: StyleProp<TextStyle>; + partTypes: PartType[]; onPress: (user: UserType) => void; } @@ -66,9 +67,10 @@ interface RenderProps { export const renderTextWithMentions: React.FC<RenderProps> = ({ value, styles, + partTypes, onPress, }) => { - const {parts} = parseValue(value, mentionPartTypes); + const {parts} = parseValue(value, partTypes); return ( <Text style={styles}> {parts.map((part, index) => renderPart(part, index, onPress))} @@ -76,12 +78,19 @@ export const renderTextWithMentions: React.FC<RenderProps> = ({ ); }; -export const mentionPartTypes: PartType[] = [ - { - trigger: '@', - renderSuggestions: (props) => <TaggTypeahead {...props} />, - allowedSpacesCount: 0, - isInsertSpaceAfterMention: true, - textStyle: {color: TAGG_LIGHT_BLUE}, - }, -]; +export const mentionPartTypes: (style: 'blue' | 'white') => PartType[] = ( + style, +) => { + return [ + { + trigger: '@', + renderSuggestions: (props) => <TaggTypeahead {...props} />, + allowedSpacesCount: 0, + isInsertSpaceAfterMention: true, + textStyle: + style === 'blue' + ? {color: TAGG_LIGHT_BLUE} + : {color: 'white', fontWeight: '800'}, + }, + ]; +}; |