aboutsummaryrefslogtreecommitdiff
path: root/src/utils/comments.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-05-07 18:48:51 -0400
committerGitHub <noreply@github.com>2021-05-07 18:48:51 -0400
commitfa51a3c6894028828679c551027ec232ed8203b1 (patch)
treeb55ece7257c868f3cb9eeae4a70fb7b220040fb5 /src/utils/comments.tsx
parent893e7bf7a49eb612a975dddae4d792a035b9f420 (diff)
parent82bfc01d95275ebe4a63695326b3b775807c2408 (diff)
Merge pull request #404 from IvanIFChen/hotfix-mentions-bugfixes
[HOTFIX] Mentions Bugfixes
Diffstat (limited to 'src/utils/comments.tsx')
-rw-r--r--src/utils/comments.tsx29
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'},
+ },
+ ];
+};