diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-25 16:26:19 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-25 16:26:19 -0400 |
commit | 8198e4349dd589be2fbc9fb42aefaa8c5915bef5 (patch) | |
tree | 6f48168171c9c7dee1ffa74b49b3e9e4ca34fc20 /src | |
parent | a6bc1f1a06a08bd842ba0b3bd00a88cea9bd9971 (diff) |
Fix video dimension in tagging screen
Diffstat (limited to 'src')
-rw-r--r-- | src/components/moments/Moment.tsx | 14 | ||||
-rw-r--r-- | src/screens/moments/TagFriendsScreen.tsx | 11 | ||||
-rw-r--r-- | src/services/MomentService.ts | 1 |
3 files changed, 16 insertions, 10 deletions
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<MomentProps> = ({ 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<TagFriendsScreenProps> = ({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<TagFriendsScreenProps> = ({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); + } }} /> </View> 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) { |