diff options
Diffstat (limited to 'src/components/moments/MomentPostContent.tsx')
| -rw-r--r-- | src/components/moments/MomentPostContent.tsx | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx index ecbfb3a2..d831d7ee 100644 --- a/src/components/moments/MomentPostContent.tsx +++ b/src/components/moments/MomentPostContent.tsx @@ -6,7 +6,7 @@ import Animated, {Easing} from 'react-native-reanimated'; import {useDispatch, useStore} from 'react-redux'; import {getCommentsCount} from '../../services'; import {RootState} from '../../store/rootReducer'; -import {MomentTagType, ScreenType, UserType} from '../../types'; +import {MomentTagType, MomentType, ScreenType, UserType} from '../../types'; import { getTimePosted, navigateToProfile, @@ -20,19 +20,13 @@ import {MomentTags} from '../common'; interface MomentPostContentProps extends ViewProps { screenType: ScreenType; - momentId: string; - caption: string; - pathHash: string; - dateTime: string; + moment: MomentType; momentTags: MomentTagType[]; } const MomentPostContent: React.FC<MomentPostContentProps> = ({ screenType, - momentId, - caption, - pathHash, - dateTime, style, + moment, momentTags, }) => { const [elapsedTime, setElapsedTime] = useState(''); @@ -54,12 +48,12 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ useEffect(() => { const fetchCommentsCount = async () => { - const count = await getCommentsCount(momentId, false); + const count = await getCommentsCount(moment.moment_id, false); setCommentsCount(count); }; - setElapsedTime(getTimePosted(dateTime)); + setElapsedTime(getTimePosted(moment.date_created)); fetchCommentsCount(); - }, [dateTime, momentId]); + }, [moment.date_created, moment.moment_id]); useEffect(() => { const fade = async () => { @@ -82,7 +76,7 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ <Image ref={imageRef} style={styles.image} - source={{uri: pathHash}} + source={{uri: moment.moment_url}} resizeMode={'cover'} /> {tags.length > 0 && ( @@ -100,13 +94,13 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ <View style={styles.footerContainer}> <CommentsCount commentsCount={comments_count} - momentId={momentId} + momentId={moment.moment_id} screenType={screenType} /> <Text style={styles.text}>{elapsedTime}</Text> </View> {renderTextWithMentions({ - value: caption, + value: moment.caption, styles: styles.captionText, partTypes: mentionPartTypes('white'), onPress: (user: UserType) => |
