aboutsummaryrefslogtreecommitdiff
path: root/src/components/taggs/TaggPost.tsx
blob: 73f152687b315ff44d5c22ebb003ac4268b795b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import moment from 'moment';
import React from 'react';
import {Image, StyleSheet, View} from 'react-native';
import {PostType} from '../../types';
import {SCREEN_WIDTH} from '../../utils';
import TaggPostFooter from './TaggPostFooter';

interface TaggPostProps {
  post: PostType;
}
const TaggPost: React.FC<TaggPostProps> = ({post: {socialHandle, data}}) => {
  const parsedDate = moment(data?.timestamp || '');
  const date = parsedDate.isValid() ? parsedDate.format('MMM d') : '';

  return (
    <>
      <View style={styles.image}>
        {data && <Image style={styles.image} source={{uri: data.media_url}} />}
      </View>
      <TaggPostFooter
        // we currently don't have a way to retreive num of likes information
        likes={109}
        handle={socialHandle}
        caption={data?.caption || ''}
        date={date}
      />
    </>
  );
};

const styles = StyleSheet.create({
  image: {
    width: SCREEN_WIDTH,
    height: SCREEN_WIDTH,
    backgroundColor: '#eee',
  },
});

export default TaggPost;