diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-06 18:36:21 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-06 18:36:21 -0400 |
commit | 807acf3c3a74c4091aeef2ab90a7b8b7f1c8d20e (patch) | |
tree | 5ab8b30b340ec03fcf40358398d70314310c7c29 /src/utils/comments.tsx | |
parent | a6ada7b34da599d3edb797d6bd9fce57ded7bac5 (diff) |
updated moment mention style
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'}, + }, + ]; +}; |