From e2474386282f44b78f7a01f0d12287e1c1fc87f8 Mon Sep 17 00:00:00 2001 From: Alex <111128610+Alexk2309@users.noreply.github.com> Date: Thu, 10 Jul 2025 23:25:57 +1000 Subject: [PATCH] Fix orientation race condition (#841) Co-authored-by: Alex Kim --- app/(auth)/player/_layout.tsx | 27 +------------------ app/_layout.tsx | 21 +++++++++++---- components/video-player/controls/Controls.tsx | 3 --- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/app/(auth)/player/_layout.tsx b/app/(auth)/player/_layout.tsx index 19e9a8d0..3c29bff4 100644 --- a/app/(auth)/player/_layout.tsx +++ b/app/(auth)/player/_layout.tsx @@ -1,33 +1,8 @@ -import * as ScreenOrientation from "@/packages/expo-screen-orientation"; -import { useSettings } from "@/utils/atoms/settings"; import { Stack } from "expo-router"; -import React, { useLayoutEffect } from "react"; -import { Platform } from "react-native"; +import React from "react"; import { SystemBars } from "react-native-edge-to-edge"; export default function Layout() { - const [settings] = useSettings(); - - useLayoutEffect(() => { - if (Platform.isTV) return; - - if (!settings.followDeviceOrientation && settings.defaultVideoOrientation) { - ScreenOrientation.lockAsync(settings.defaultVideoOrientation); - } - - return () => { - if (Platform.isTV) return; - - if (settings.followDeviceOrientation === true) { - ScreenOrientation.unlockAsync(); - } else { - ScreenOrientation.lockAsync( - ScreenOrientation.OrientationLock.PORTRAIT_UP, - ); - } - }; - }); - return ( <>