From 4eab1ebff67b30ec50f2d288d7e55be60d4b3faf Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Wed, 18 Sep 2024 08:42:26 +0200 Subject: [PATCH] chore --- utils/OrientationLockConverter.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 utils/OrientationLockConverter.ts diff --git a/utils/OrientationLockConverter.ts b/utils/OrientationLockConverter.ts new file mode 100644 index 00000000..748ffcc6 --- /dev/null +++ b/utils/OrientationLockConverter.ts @@ -0,0 +1,21 @@ +import { Orientation, OrientationLock } from "expo-screen-orientation"; + +function orientationToOrientationLock( + orientation: Orientation +): OrientationLock { + switch (orientation) { + case Orientation.PORTRAIT_UP: + return OrientationLock.PORTRAIT_UP; + case Orientation.PORTRAIT_DOWN: + return OrientationLock.PORTRAIT_DOWN; + case Orientation.LANDSCAPE_LEFT: + return OrientationLock.LANDSCAPE_LEFT; + case Orientation.LANDSCAPE_RIGHT: + return OrientationLock.LANDSCAPE_RIGHT; + case Orientation.UNKNOWN: + default: + return OrientationLock.DEFAULT; + } +} + +export default orientationToOrientationLock;