diff --git a/app/(auth)/(tabs)/(libraries)/[libraryId].tsx b/app/(auth)/(tabs)/(libraries)/[libraryId].tsx
index f2439409..1f345a0a 100644
--- a/app/(auth)/(tabs)/(libraries)/[libraryId].tsx
+++ b/app/(auth)/(tabs)/(libraries)/[libraryId].tsx
@@ -32,7 +32,6 @@ import {
tagsFilterAtom,
yearFilterAtom,
} from "@/utils/atoms/filters";
-import { orientationAtom } from "@/utils/atoms/orientation";
import {
BaseItemDto,
BaseItemDtoQueryResult,
@@ -44,6 +43,7 @@ import {
} from "@jellyfin/sdk/lib/utils/api";
import { FlashList } from "@shopify/flash-list";
import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { useOrientation } from "@/hooks/useOrientation";
const MemoizedTouchableItemRouter = React.memo(TouchableItemRouter);
@@ -60,12 +60,13 @@ const Page = () => {
const [selectedTags, setSelectedTags] = useAtom(tagsFilterAtom);
const [sortBy, _setSortBy] = useAtom(sortByAtom);
const [sortOrder, _setSortOrder] = useAtom(sortOrderAtom);
- const [orientation] = useAtom(orientationAtom);
const [sortByPreference, setSortByPreference] = useAtom(sortByPreferenceAtom);
const [sortOrderPreference, setOderByPreference] = useAtom(
sortOrderPreferenceAtom
);
+ const { orientation } = useOrientation();
+
useEffect(() => {
const sop = getSortOrderPreference(libraryId, sortOrderPreference);
if (sop) {
@@ -106,11 +107,12 @@ const Page = () => {
[libraryId, sortOrderPreference]
);
- const getNumberOfColumns = useCallback(() => {
- if (orientation === ScreenOrientation.Orientation.PORTRAIT_UP) return 3;
- if (screenWidth < 600) return 5;
- if (screenWidth < 960) return 6;
- if (screenWidth < 1280) return 7;
+ const nrOfCols = useMemo(() => {
+ if (screenWidth < 300) return 2;
+ if (screenWidth < 500) return 3;
+ if (screenWidth < 800) return 5;
+ if (screenWidth < 1000) return 6;
+ if (screenWidth < 1500) return 7;
return 6;
}, [screenWidth, orientation]);
@@ -219,7 +221,7 @@ const Page = () => {
const renderItem = useCallback(
({ item, index }: { item: BaseItemDto; index: number }) => (
- {
{
-
+
),
[orientation]
);
@@ -429,6 +431,7 @@ const Page = () => {
return (
No results
@@ -437,10 +440,10 @@ const Page = () => {
contentInsetAdjustmentBehavior="automatic"
data={flatData}
renderItem={renderItem}
- extraData={orientation}
+ extraData={[orientation, nrOfCols]}
keyExtractor={keyExtractor}
estimatedItemSize={244}
- numColumns={getNumberOfColumns()}
+ numColumns={nrOfCols}
onEndReached={() => {
if (hasNextPage) {
fetchNextPage();
diff --git a/app/(auth)/play-video.tsx b/app/(auth)/play-video.tsx
index fc2378a2..59ef2733 100644
--- a/app/(auth)/play-video.tsx
+++ b/app/(auth)/play-video.tsx
@@ -214,18 +214,28 @@ export default function page() {
return (
{
setShowControls(!showControls);
}}
- className="absolute z-0 h-full w-full"
+ style={{
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: screenDimensions.width,
+ height: screenDimensions.height,
+ zIndex: 0,
+ }}
>