aboutsummaryrefslogtreecommitdiff
path: root/src/components/taggs/TaggPost.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@thetaggid.com>2020-10-27 20:44:36 -0400
committerGitHub <noreply@github.com>2020-10-27 20:44:36 -0400
commit24c269c9d52ec7cf2cd383a8d7c3aee43ed475c1 (patch)
tree39044f1b6a4f52db941a75f9fa30a1184bf06720 /src/components/taggs/TaggPost.tsx
parentb41a975012172ba336b27ab3d64ed078b07633cd (diff)
[TMA-180] Image Carousel for Tagg Posts (#77)
* image carousel done * fixed a minor bug * TikTok is TikTok NOT Tiktok OKAY? Co-authored-by: Husam Salhab <47015061+hsalhab@users.noreply.github.com>
Diffstat (limited to 'src/components/taggs/TaggPost.tsx')
-rw-r--r--src/components/taggs/TaggPost.tsx24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/components/taggs/TaggPost.tsx b/src/components/taggs/TaggPost.tsx
index 07efd797..071dbfc4 100644
--- a/src/components/taggs/TaggPost.tsx
+++ b/src/components/taggs/TaggPost.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import {Image, StyleSheet, Text, View} from 'react-native';
import {SimplePostType} from '../../types';
import {SCREEN_WIDTH} from '../../utils';
-import {DateLabel} from '../common';
+import {DateLabel, PostCarousel} from '../common';
import TaggPostFooter from './TaggPostFooter';
import Hyperlink from 'react-native-hyperlink';
@@ -14,11 +14,18 @@ const TaggPost: React.FC<TaggPostProps> = ({post}) => {
// Post with image and footer that shows caption
return (
<View style={styles.photoContainer}>
- <View style={styles.image}>
- {post && (
- <Image style={styles.image} source={{uri: post.media_url}} />
- )}
- </View>
+ {post.media_url.length === 1 && post.media_url[0] !== null ? (
+ <Image
+ style={styles.imageWithMargin}
+ source={{uri: post.media_url[0]}}
+ />
+ ) : (
+ <PostCarousel
+ data={post.media_url}
+ imageStyles={styles.image}
+ marginBottom={30}
+ />
+ )}
<TaggPostFooter
// we currently don't have a way to retreive num of likes information
likes={undefined}
@@ -49,6 +56,11 @@ const styles = StyleSheet.create({
width: SCREEN_WIDTH,
height: SCREEN_WIDTH,
backgroundColor: '#eee',
+ },
+ imageWithMargin: {
+ width: SCREEN_WIDTH,
+ height: SCREEN_WIDTH,
+ backgroundColor: '#eee',
marginBottom: 30,
},
textContianer: {marginBottom: 50, paddingHorizontal: 10},