aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-23 18:31:10 -0400
committerIvan Chen <ivan@tagg.id>2021-07-23 18:36:29 -0400
commit811426f6a4d2e3495d45c0ed1b209f2ea539e26f (patch)
treed9f917acdb8654a2c8e569f8041d8d965b06a96f
parentbc5974a4fa262e2b33f25298671b7fdd90e55937 (diff)
Fix orientation issue
-rw-r--r--src/components/moments/TrimmerPlayer.tsx7
-rw-r--r--src/screens/upload/EditMedia.tsx3
2 files changed, 7 insertions, 3 deletions
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<TrimmerPlayerProps> = ({
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<EditMediaProps> = ({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);
}}