aboutsummaryrefslogtreecommitdiff
path: root/src/components/moments/MomentPostContent.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/moments/MomentPostContent.tsx')
-rw-r--r--src/components/moments/MomentPostContent.tsx24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx
index 378931d1..5192fdf0 100644
--- a/src/components/moments/MomentPostContent.tsx
+++ b/src/components/moments/MomentPostContent.tsx
@@ -5,12 +5,19 @@ import {TouchableWithoutFeedback} from 'react-native-gesture-handler';
import Animated, {EasingNode} from 'react-native-reanimated';
import {useDispatch, useStore} from 'react-redux';
import {RootState} from '../../store/rootReducer';
-import {MomentPostType, MomentTagType, ScreenType, UserType} from '../../types';
+import {
+ MomentCommentPreviewType,
+ MomentPostType,
+ MomentTagType,
+ ScreenType,
+ UserType,
+} from '../../types';
import {
getTimePosted,
navigateToProfile,
normalize,
SCREEN_WIDTH,
+ getLoggedInUserAsProfilePreview,
} from '../../utils';
import {mentionPartTypes, renderTextWithMentions} from '../../utils/comments';
import {AddComment} from '../comments';
@@ -37,6 +44,8 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
const [fadeValue, setFadeValue] = useState<Animated.Value<number>>(
new Animated.Value(0),
);
+ const [commentPreview, setCommentPreview] =
+ useState<MomentCommentPreviewType | null>(moment.comment_preview);
useEffect(() => {
setTags(momentTags);
@@ -91,10 +100,21 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
onPress: (user: UserType) =>
navigateToProfile(state, dispatch, navigation, screenType, user),
})}
- <MomentCommentPreview moment={moment} screenType={screenType} />
+ <MomentCommentPreview
+ momentId={moment.moment_id}
+ commentsCount={moment.comments_count}
+ commentPreview={commentPreview}
+ screenType={screenType}
+ />
<AddComment
placeholderText={'Add a comment here!'}
momentId={moment.moment_id}
+ callback={(message) =>
+ setCommentPreview({
+ commenter: getLoggedInUserAsProfilePreview(state),
+ comment: message,
+ })
+ }
theme={'dark'}
/>
<Text style={styles.text}>{getTimePosted(moment.date_created)}</Text>