From 811426f6a4d2e3495d45c0ed1b209f2ea539e26f Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 23 Jul 2021 18:31:10 -0400 Subject: Fix orientation issue --- src/components/moments/TrimmerPlayer.tsx | 7 ++++++- src/screens/upload/EditMedia.tsx | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/moments/TrimmerPlayer.tsx b/src/components/moments/TrimmerPlayer.tsx index 87b3a786..247c270f 100644 --- a/src/components/moments/TrimmerPlayer.tsx +++ b/src/components/moments/TrimmerPlayer.tsx @@ -73,7 +73,12 @@ const TrimmerPlayer: React.FC = ({ repeat={true} onLoad={(payload) => { setEnd(payload.duration); - handleLoad(payload.naturalSize); + const {width, height} = payload.naturalSize; + if (payload.naturalSize.orientation === 'portrait') { + handleLoad(height, width); + } else { + handleLoad(width, height); + } }} onProgress={(e) => { if (!paused) { diff --git a/src/screens/upload/EditMedia.tsx b/src/screens/upload/EditMedia.tsx index f8e7692d..10f5f2fb 100644 --- a/src/screens/upload/EditMedia.tsx +++ b/src/screens/upload/EditMedia.tsx @@ -338,8 +338,7 @@ export const EditMedia: React.FC = ({route, navigation}) => { height: SCREEN_WIDTH / aspectRatio, }, ]} - handleLoad={(response: {width: number; height: number}) => { - const {width, height} = response; + handleLoad={(width: number, height: number) => { setOrigDimensions([width, height]); setAspectRatio(width / height); }} -- cgit v1.2.3-70-g09d2