fix: portrait orientation when tabs focused

This commit is contained in:
Adrian Castro
2024-02-23 16:17:57 +01:00
parent b6782c4493
commit a43cb420d5

View File

@@ -2,6 +2,7 @@ import { useRef } from "react";
import { Platform, View } from "react-native"; import { Platform, View } from "react-native";
import * as Haptics from "expo-haptics"; import * as Haptics from "expo-haptics";
import { Tabs } from "expo-router"; import { Tabs } from "expo-router";
import * as ScreenOrientation from "expo-screen-orientation";
import Colors from "@movie-web/tailwind-config/colors"; import Colors from "@movie-web/tailwind-config/colors";
@@ -29,6 +30,11 @@ export default function TabLayout() {
break; break;
} }
}, },
focus: () => {
void ScreenOrientation.lockAsync(
ScreenOrientation.OrientationLock.PORTRAIT_UP,
);
},
})} })}
screenOptions={{ screenOptions={{
headerShown: false, headerShown: false,