aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-15 15:24:58 -0400
committerIvan Chen <ivan@tagg.id>2021-07-15 15:24:58 -0400
commitbc9001004b44f84aa3bd850e6bd3eccbe1ae4c27 (patch)
treeb174716df84e6658befa069d14162394ef292f13
parentd012373314f1af1b02e35994cce9f4450380b35e (diff)
Fix tag position issue
-rw-r--r--src/components/moments/MomentPost.tsx20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index 07295369..e789a9bf 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -83,6 +83,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
moment.moment_url.endsWith('GIF') ||
moment.moment_url.endsWith('gif')
);
+ const mediaHeight = SCREEN_WIDTH / aspectRatio;
/*
* Load tags on initial render to pass tags data to moment header and content
@@ -201,14 +202,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
<View style={styles.mainContainer}>
<View style={styles.imageContainer}>
{isVideo ? (
- <View
- ref={imageRef}
- style={[
- styles.media,
- {
- height: SCREEN_WIDTH / aspectRatio,
- },
- ]}>
+ <View ref={imageRef}>
<Video
ref={videoRef}
source={{
@@ -218,7 +212,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
style={[
styles.media,
{
- height: SCREEN_WIDTH / aspectRatio,
+ height: mediaHeight,
},
]}
repeat={true}
@@ -233,7 +227,12 @@ const MomentPost: React.FC<MomentPostProps> = ({
) : (
<Image
source={{uri: moment.moment_url}}
- style={styles.media}
+ style={[
+ styles.media,
+ {
+ height: mediaHeight,
+ },
+ ]}
resizeMode={'contain'}
ref={imageRef}
/>
@@ -337,7 +336,6 @@ const MomentPost: React.FC<MomentPostProps> = ({
const styles = StyleSheet.create({
media: {
zIndex: 0,
- flex: 1,
},
imageContainer: {
height: SCREEN_HEIGHT,