Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix orientation check

Ammar Ahmedc395bc829f7f
diff --git a/apps/mobile/app/navigation/fluid-panels-view.tsx b/apps/mobile/app/navigation/fluid-panels-view.tsx
index 03aa61bf3..70fb08409 100644
--- a/apps/mobile/app/navigation/fluid-panels-view.tsx
+++ b/apps/mobile/app/navigation/fluid-panels-view.tsx
@@ -68,6 +68,7 @@ import {
import { editorRef, fluidTabsRef } from "../utils/global-refs";
import { AppNavigationStack } from "./navigation-stack";
import Orientation, {
+ OrientationType,
useDeviceOrientationChange
} from "react-native-orientation-locker";
@@ -93,18 +94,18 @@ export const FluidPanelsView = React.memo(
const animatedOpacity = useSharedValue(0);
const animatedTranslateY = useSharedValue(-9999);
const overlayRef = useRef<Animated.View>(null);
- const [orientation, setOrientation] = useState<"PORTRAIT" | "LANDSCAPE">(
- Orientation.getInitialOrientation().includes("PORTRAIT")
- ? "PORTRAIT"
- : "LANDSCAPE"
+ const [orientation, setOrientation] = useState<OrientationType>(
+ Orientation.getInitialOrientation()
);
const appLoading = useSettingStore((state) => state.isAppLoading);
const [isLoading, setIsLoading] = useState(false);
useDeviceOrientationChange((o) => {
- setOrientation(o.includes("PORTRAIT") ? "PORTRAIT" : "LANDSCAPE");
+ setOrientation(o);
});
+ const isLandscape = orientation.includes("LANDSCAPE");
+
useEffect(() => {
if (!appLoading) {
setTimeout(() => {