aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-25 16:40:35 -0400
committerIvan Chen <ivan@tagg.id>2021-06-25 16:40:35 -0400
commit4bab63b7b0c24043749e78cbb4d639e8a4047bad (patch)
treea484681eeb461692d050559e5c240db9cccf274b /src/components
parent8198e4349dd589be2fbc9fb42aefaa8c5915bef5 (diff)
Add logic to pause video when not visible
Diffstat (limited to 'src/components')
-rw-r--r--src/components/moments/MomentPost.tsx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index 770cdcee..e6bb5405 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -72,7 +72,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
const [momentTagId, setMomentTagId] = useState<string>('');
const imageRef = useRef(null);
- const {keyboardVisible} = useContext(MomentContext);
+ const {keyboardVisible, currentVisibleMomentId} = useContext(MomentContext);
const isVideo = !(
moment.moment_url.endsWith('jpg') ||
moment.moment_url.endsWith('JPG') ||
@@ -213,6 +213,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
const {width, height} = response.naturalSize;
setAspectRatio(width / height);
}}
+ paused={moment.moment_id !== currentVisibleMomentId}
/>
</View>
) : (