forked from Ninjalama/streamyfin_mirror
fix: orientation lock being activated even when auto rotate is on
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
import { Stack } from "expo-router";
|
||||
import React, { useEffect } from "react";
|
||||
import { SystemBars } from "react-native-edge-to-edge";
|
||||
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 { SystemBars } from "react-native-edge-to-edge";
|
||||
|
||||
export default function Layout() {
|
||||
const [settings] = useSettings();
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
if (Platform.isTV) return;
|
||||
|
||||
if (settings.defaultVideoOrientation) {
|
||||
if (!settings.followDeviceOrientation && settings.defaultVideoOrientation) {
|
||||
ScreenOrientation.lockAsync(settings.defaultVideoOrientation);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (Platform.isTV) return;
|
||||
|
||||
if (settings.autoRotate === true) {
|
||||
if (settings.followDeviceOrientation === true) {
|
||||
ScreenOrientation.unlockAsync();
|
||||
} else {
|
||||
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
|
||||
}
|
||||
};
|
||||
}, [settings.defaultVideoOrientation, settings.autoRotate]);
|
||||
}, [settings.autoDownload, settings.defaultVideoOrientation]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user