diff options
-rw-r--r-- | src/components/moments/MomentCommentPreview.tsx | 6 | ||||
-rw-r--r-- | src/components/moments/MomentPostContent.tsx | 2 | ||||
-rw-r--r-- | src/utils/comments.tsx | 38 |
3 files changed, 20 insertions, 26 deletions
diff --git a/src/components/moments/MomentCommentPreview.tsx b/src/components/moments/MomentCommentPreview.tsx index 03f30dda..94fcb008 100644 --- a/src/components/moments/MomentCommentPreview.tsx +++ b/src/components/moments/MomentCommentPreview.tsx @@ -23,12 +23,6 @@ const MomentCommentPreview: React.FC<MomentCommentPreviewProps> = ({ ? 'No Comments' : moment.comments_count + ' comments'; - /** - * TODO: - * - figure out why mention PartTypes have type warnings - * - fix padding for all types (double check on iPhone 8) - */ - return ( <TouchableOpacity style={styles.commentsPreviewContainer} diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx index 5fd683a4..378931d1 100644 --- a/src/components/moments/MomentPostContent.tsx +++ b/src/components/moments/MomentPostContent.tsx @@ -87,7 +87,7 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ renderTextWithMentions({ value: moment.caption, styles: styles.captionText, - partTypes: mentionPartTypes('white'), + partTypes: mentionPartTypes('momentCaption'), onPress: (user: UserType) => navigateToProfile(state, dispatch, navigation, screenType, user), })} diff --git a/src/utils/comments.tsx b/src/utils/comments.tsx index e700da88..161ede0b 100644 --- a/src/utils/comments.tsx +++ b/src/utils/comments.tsx @@ -79,9 +79,23 @@ export const renderTextWithMentions: React.FC<RenderProps> = ({ ); }; -const textStyle: (theme: 'blue' | 'white' | 'commentPreview') => PartType = ( - theme, -) => { +export const mentionPartTypes: ( + theme: 'blue' | 'momentCaption' | 'commentPreview', +) => PartType[] = (theme) => { + return [ + { + trigger: '@', + renderSuggestions: (props) => <TaggTypeahead {...props} />, + allowedSpacesCount: 0, + isInsertSpaceAfterMention: true, + textStyle: _textStyle(theme), + }, + ]; +}; + +const _textStyle: ( + theme: 'blue' | 'momentCaption' | 'commentPreview', +) => StyleProp<TextStyle> = (theme) => { switch (theme) { case 'blue': return { @@ -94,26 +108,12 @@ const textStyle: (theme: 'blue' | 'white' | 'commentPreview') => PartType = ( fontWeight: '800', top: normalize(3), }; - case 'white': + case 'momentCaption': default: return { color: 'white', fontWeight: '800', - top: normalize(7.5), + top: normalize(4.5), }; } }; - -export const mentionPartTypes: ( - theme: 'blue' | 'white' | 'commentPreview', -) => PartType[] = (theme) => { - return [ - { - trigger: '@', - renderSuggestions: (props) => <TaggTypeahead {...props} />, - allowedSpacesCount: 0, - isInsertSpaceAfterMention: true, - textStyle: textStyle(theme), - }, - ]; -}; |