From 8198e4349dd589be2fbc9fb42aefaa8c5915bef5 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 25 Jun 2021 16:26:19 -0400 Subject: Fix video dimension in tagging screen --- src/components/moments/Moment.tsx | 14 ++++++++------ src/screens/moments/TagFriendsScreen.tsx | 11 ++++++++--- src/services/MomentService.ts | 1 - 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 47de1c6a..a43a2830 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -157,12 +157,14 @@ const Moment: React.FC = ({ onPress: () => ImagePicker.openCamera({ mediaType: 'video', - }).then((vid) => { - console.log(vid); - if (vid.path) { - navigateToCaptionScreenForVideo(vid.path); - } - }), + }) + .then((vid) => { + console.log(vid); + if (vid.path) { + navigateToCaptionScreenForVideo(vid.path); + } + }) + .catch((err) => console.error(err)), }, ]) } diff --git a/src/screens/moments/TagFriendsScreen.tsx b/src/screens/moments/TagFriendsScreen.tsx index 81415437..201caf49 100644 --- a/src/screens/moments/TagFriendsScreen.tsx +++ b/src/screens/moments/TagFriendsScreen.tsx @@ -66,7 +66,7 @@ const TagFriendsScreen: React.FC = ({route}) => { * Calculating image width and height with respect to it's enclosing view's dimensions. Only works for images. */ useEffect(() => { - if (imageRef && imageRef.current) { + if (imageRef && imageRef.current && !media.isVideo) { Image.getSize( media.uri, (w, h) => { @@ -120,8 +120,13 @@ const TagFriendsScreen: React.FC = ({route}) => { source={{uri: media.uri}} repeat={true} onLoad={(response) => { - const {width, height} = response.naturalSize; - setMediaDimensions(width, height); + const {width, height, orientation} = response.naturalSize; + // portrait will flip width and height + if (orientation === 'portrait') { + setMediaDimensions(height, width); + } else { + setMediaDimensions(width, height); + } }} /> diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts index ca32a3f3..b274ef04 100644 --- a/src/services/MomentService.ts +++ b/src/services/MomentService.ts @@ -241,7 +241,6 @@ export const handlePresignedURL = async ( const status = response.status; let data: PresignedURLResponse = await response.json(); if (status === 200) { - console.log('done'); return data; } else { if (status === 404) { -- cgit v1.2.3-70-g09d2