fix: rename auto rotate to follow device orientation

This commit is contained in:
Fredrik Burmester
2025-03-07 07:54:13 +01:00
parent 3d7889e19a
commit 887f30e739
14 changed files with 98 additions and 116 deletions

View File

@@ -9,21 +9,17 @@ export const useOrientationSettings = () => {
const [settings] = useSettings();
useEffect(() => {
if (settings?.autoRotate) {
ScreenOrientation.lockAsync(
ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT
);
if (settings?.followDeviceOrientation) {
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT);
} else if (settings?.defaultVideoOrientation) {
ScreenOrientation.lockAsync(settings.defaultVideoOrientation);
}
return () => {
if (settings?.autoRotate) {
if (settings?.followDeviceOrientation) {
ScreenOrientation.unlockAsync();
} else {
ScreenOrientation.lockAsync(
ScreenOrientation.OrientationLock.PORTRAIT_UP
);
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
}
};
}, [settings]);