From 2d9dc006832efc32c3e87fb42b637093f41d017a Mon Sep 17 00:00:00 2001 From: xmflsct Date: Sat, 7 Jan 2023 23:56:24 +0100 Subject: [PATCH] Fix #633 https://github.com/expo/expo/issues/6864#issuecomment-678620290 --- ios/Podfile.lock | 19 ++++++++++----- package.json | 2 +- .../Timeline/Shared/Attachment/Video.tsx | 24 ++++++++++++------- yarn.lock | 21 ++++++++-------- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2ccb5d97..6c4225a0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -16,7 +16,7 @@ PODS: - ExpoModulesCore - EXNotifications (0.17.0): - ExpoModulesCore - - Expo (47.0.11): + - Expo (47.0.12): - ExpoModulesCore - ExpoCrypto (12.1.0): - ExpoModulesCore @@ -26,7 +26,7 @@ PODS: - ExpoModulesCore - ExpoLocalization (14.0.0): - ExpoModulesCore - - ExpoModulesCore (1.1.0): + - ExpoModulesCore (1.1.1): - React-Core - ReactCommon/turbomodule/core - ExpoRandom (13.0.0): @@ -39,6 +39,9 @@ PODS: - ExpoModulesCore - EXScreenCapture (5.0.0): - ExpoModulesCore + - EXScreenOrientation (5.0.1): + - ExpoModulesCore + - React-Core - EXSecureStore (12.0.0): - ExpoModulesCore - EXSplashScreen (0.17.5): @@ -298,7 +301,7 @@ PODS: - React-Core - react-native-blurhash (1.1.10): - React-Core - - react-native-cameraroll (5.2.0): + - react-native-cameraroll (5.2.1): - React-Core - react-native-image-picker (4.10.3): - React-Core @@ -470,6 +473,7 @@ DEPENDENCIES: - ExpoVideoThumbnails (from `../node_modules/expo-video-thumbnails/ios`) - ExpoWebBrowser (from `../node_modules/expo-web-browser/ios`) - EXScreenCapture (from `../node_modules/expo-screen-capture/ios`) + - EXScreenOrientation (from `../node_modules/expo-screen-orientation/ios`) - EXSecureStore (from `../node_modules/expo-secure-store/ios`) - EXSplashScreen (from `../node_modules/expo-splash-screen/ios`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) @@ -582,6 +586,8 @@ EXTERNAL SOURCES: :path: "../node_modules/expo-web-browser/ios" EXScreenCapture: :path: "../node_modules/expo-screen-capture/ios" + EXScreenOrientation: + :path: "../node_modules/expo-screen-orientation/ios" EXSecureStore: :path: "../node_modules/expo-secure-store/ios" EXSplashScreen: @@ -705,17 +711,18 @@ SPEC CHECKSUMS: EXFileSystem: 60602b6eefa6873f97172c684b7537c9760b50d6 EXFont: 319606bfe48c33b5b5063fb0994afdc496befe80 EXNotifications: babce2a87b7922051354fcfe7a74dd279b7e272a - Expo: dedd83acfd4d70cbec6ac2f1b4433462d95c70bc + Expo: f48d305fda3e4e501d686e6bad7d8c8373828279 ExpoCrypto: 6eb2a5ede7d95b7359a5f0391ee0c5d2ecd144b3 ExpoHaptics: 129d3f8d44c2205adcdf8db760602818463d5437 ExpoKeepAwake: 69b59d0a8d2b24de9f82759c39b3821fec030318 ExpoLocalization: e202d1e2a4950df17ac8d0889d65a1ffd7532d7e - ExpoModulesCore: 089e1ac0f0edee4dd0af0eb4e3f7b44d72cc418d + ExpoModulesCore: 485dff3a59b036a33b6050c0a5aea3cf1037fdd1 ExpoRandom: 58b7e0a5fe1adf1cb6dc1cbe503a6fe9524f36ce ExpoStoreReview: 713336ff504db3a6983475bf7c67519cc5efc86f ExpoVideoThumbnails: 424db02cedfbbe2d498bcb2712ea4ba8a9dcb453 ExpoWebBrowser: 073e50f16669d498fb49063b9b7fe780b24f7fda EXScreenCapture: d9f1ec31042dfef109290d06c2b4789b7444d16d + EXScreenOrientation: 07e5aeff07bce09a2b214981e612d87fd7719997 EXSecureStore: daec0117c922a67c658cb229152a9e252e5c1750 EXSplashScreen: 3e989924f61a8dd07ee4ea584c6ba14be9b51949 FBLazyVector: 48289402952f4f7a4e235de70a9a590aa0b79ef4 @@ -744,7 +751,7 @@ SPEC CHECKSUMS: React-logger: 1623c216abaa88974afce404dc8f479406bbc3a0 react-native-blur: 50c9feabacbc5f49b61337ebc32192c6be7ec3c3 react-native-blurhash: add4df9a937b4e021a24bc67a0714f13e0bd40b7 - react-native-cameraroll: 0ff04cc4e0ff5f19a94ff4313e5c8bc4503cd86d + react-native-cameraroll: f94bf9f46c998963ecd2bb6e9a3f9cca59b6d9f1 react-native-image-picker: 60f4246eb5bb7187fc15638a8c1f13abd3820695 react-native-ios-context-menu: b170594b4448c0cd10c79e13432216bac99de1ac react-native-language-detection: f414937fa715108ab50a6269a3de0bcb95e4ceb0 diff --git a/package.json b/package.json index 3c1a4309..144490ed 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "expo-notifications": "^0.17.0", "expo-random": "^13.0.0", "expo-screen-capture": "^5.0.0", + "expo-screen-orientation": "^5.0.1", "expo-secure-store": "^12.0.0", "expo-splash-screen": "^0.17.5", "expo-store-review": "^6.1.0", @@ -73,7 +74,6 @@ "react-native-fast-image": "^8.6.3", "react-native-feather": "^1.1.2", "react-native-flash-message": "^0.4.0", - "react-native-flipper": "^0.176.1", "react-native-gesture-handler": "~2.8.0", "react-native-image-picker": "^4.10.3", "react-native-ios-context-menu": "^1.15.1", diff --git a/src/components/Timeline/Shared/Attachment/Video.tsx b/src/components/Timeline/Shared/Attachment/Video.tsx index 6f4a86ad..cd8ac046 100644 --- a/src/components/Timeline/Shared/Attachment/Video.tsx +++ b/src/components/Timeline/Shared/Attachment/Video.tsx @@ -4,6 +4,7 @@ import { useGlobalStorage } from '@utils/storage/actions' import { StyleConstants } from '@utils/styles/constants' import { ResizeMode, Video, VideoFullscreenUpdate } from 'expo-av' import { Platform } from 'expo-modules-core' +import * as ScreenOrientation from 'expo-screen-orientation' import React, { useRef, useState } from 'react' import { Pressable, View } from 'react-native' import { Blurhash } from 'react-native-blurhash' @@ -72,14 +73,21 @@ const AttachmentVideo: React.FC = ({ posterStyle: { resizeMode: ResizeMode.COVER } })} useNativeControls={false} - onFullscreenUpdate={event => { - if (event.fullscreenUpdate === VideoFullscreenUpdate.PLAYER_DID_DISMISS) { - Platform.OS === 'android' && setVideoResizeMode(ResizeMode.COVER) - if (gifv && !reduceMotionEnabled && autoplayGifv) { - videoPlayer.current?.playAsync() - } else { - videoPlayer.current?.pauseAsync() - } + onFullscreenUpdate={async ({ fullscreenUpdate }) => { + switch (fullscreenUpdate) { + case VideoFullscreenUpdate.PLAYER_DID_PRESENT: + Platform.OS === 'android' && (await ScreenOrientation.unlockAsync()) + break + case VideoFullscreenUpdate.PLAYER_WILL_DISMISS: + Platform.OS === 'android' && + (await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT)) + Platform.OS === 'android' && setVideoResizeMode(ResizeMode.COVER) + if (gifv && !reduceMotionEnabled && autoplayGifv) { + videoPlayer.current?.playAsync() + } else { + videoPlayer.current?.pauseAsync() + } + break } }} onPlaybackStatusUpdate={event => { diff --git a/yarn.lock b/yarn.lock index e667382c..b43642b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5741,6 +5741,15 @@ __metadata: languageName: node linkType: hard +"expo-screen-orientation@npm:^5.0.1": + version: 5.0.1 + resolution: "expo-screen-orientation@npm:5.0.1" + peerDependencies: + expo: "*" + checksum: 7ede30533a8c492f82b58c3b8be110b6373ffcc2cbe273299d9f15d9aa943d678d8aaffb3d2565780b45d1d5a2a1ddea54d813fc84c06e30e3cfd59abbd8e30e + languageName: node + linkType: hard + "expo-secure-store@npm:^12.0.0": version: 12.0.0 resolution: "expo-secure-store@npm:12.0.0" @@ -9564,16 +9573,6 @@ __metadata: languageName: node linkType: hard -"react-native-flipper@npm:^0.176.1": - version: 0.176.1 - resolution: "react-native-flipper@npm:0.176.1" - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-native: ">0.62.0" - checksum: f8ba597190baaed791a73d474ab8c2410048025f6bf8b1e49b5b64b71f08453d50fa118113a4c37e5fd8bb1c7700f8afe84671afeab6ad912a5f0c4da41a35be - languageName: node - linkType: hard - "react-native-gesture-handler@npm:~2.8.0": version: 2.8.0 resolution: "react-native-gesture-handler@npm:2.8.0" @@ -11303,6 +11302,7 @@ __metadata: expo-notifications: ^0.17.0 expo-random: ^13.0.0 expo-screen-capture: ^5.0.0 + expo-screen-orientation: ^5.0.1 expo-secure-store: ^12.0.0 expo-splash-screen: ^0.17.5 expo-store-review: ^6.1.0 @@ -11323,7 +11323,6 @@ __metadata: react-native-fast-image: ^8.6.3 react-native-feather: ^1.1.2 react-native-flash-message: ^0.4.0 - react-native-flipper: ^0.176.1 react-native-gesture-handler: ~2.8.0 react-native-image-picker: ^4.10.3 react-native-ios-context-menu: ^1.15.1