fix: android header bugs

This commit is contained in:
Fredrik Burmester
2024-09-10 10:25:48 +03:00
parent 6f34f2e6a6
commit 907f6193b5
7 changed files with 54 additions and 13 deletions

View File

@@ -61,6 +61,16 @@ export default function IndexLayout() {
{Object.entries(nestedTabPageScreenOptions).map(([name, options]) => (
<Stack.Screen key={name} name={name} options={options} />
))}
<Stack.Screen
name="collections/[collectionId]"
options={{
title: "",
headerShown: true,
headerBlurEffect: "prominent",
headerTransparent: Platform.OS === "ios" ? true : false,
headerShadowVisible: false,
}}
/>
</Stack>
);
}

View File

@@ -1,5 +1,9 @@
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
import { useFocusEffect, useLocalSearchParams } from "expo-router";
import {
useFocusEffect,
useLocalSearchParams,
useNavigation,
} from "expo-router";
import * as ScreenOrientation from "expo-screen-orientation";
import { useAtom } from "jotai";
import React, { useCallback, useEffect, useLayoutEffect, useMemo } from "react";
@@ -128,6 +132,13 @@ const Page = () => {
staleTime: 60 * 1000,
});
const navigation = useNavigation();
useEffect(() => {
navigation.setOptions({
title: library?.Name || "",
});
}, [library]);
const fetchItems = useCallback(
async ({
pageParam,

View File

@@ -195,6 +195,16 @@ export default function IndexLayout() {
{Object.entries(nestedTabPageScreenOptions).map(([name, options]) => (
<Stack.Screen key={name} name={name} options={options} />
))}
<Stack.Screen
name="collections/[collectionId]"
options={{
title: "",
headerShown: true,
headerBlurEffect: "prominent",
headerTransparent: Platform.OS === "ios" ? true : false,
headerShadowVisible: false,
}}
/>
</Stack>
);
}

View File

@@ -19,6 +19,16 @@ export default function SearchLayout() {
{Object.entries(nestedTabPageScreenOptions).map(([name, options]) => (
<Stack.Screen key={name} name={name} options={options} />
))}
<Stack.Screen
name="collections/[collectionId]"
options={{
title: "",
headerShown: true,
headerBlurEffect: "prominent",
headerTransparent: Platform.OS === "ios" ? true : false,
headerShadowVisible: false,
}}
/>
</Stack>
);
}

View File

@@ -278,9 +278,9 @@ export default function search() {
<HorizontalScroll
data={data}
renderItem={(item) => (
<TouchableOpacity
<TouchableItemRouter
key={item.Id}
onPress={() => router.push(`/series/${item.Id}`)}
item={item}
className="flex flex-col w-28"
>
<SeriesPoster item={item} key={item.Id} />
@@ -290,7 +290,7 @@ export default function search() {
<Text className="opacity-50 text-xs">
{item.ProductionYear}
</Text>
</TouchableOpacity>
</TouchableItemRouter>
)}
/>
)}
@@ -302,14 +302,14 @@ export default function search() {
<HorizontalScroll
data={data}
renderItem={(item) => (
<TouchableOpacity
<TouchableItemRouter
item={item}
key={item.Id}
onPress={() => router.push(`/items/page?id=${item.Id}`)}
className="flex flex-col w-44"
>
<ContinueWatchingPoster item={item} />
<ItemCardText item={item} />
</TouchableOpacity>
</TouchableItemRouter>
)}
/>
)}
@@ -321,16 +321,16 @@ export default function search() {
<HorizontalScroll
data={data}
renderItem={(item) => (
<TouchableOpacity
<TouchableItemRouter
key={item.Id}
item={item}
className="flex flex-col w-28"
onPress={() => router.push(`/collections/${item.Id}`)}
>
<MoviePoster item={item} key={item.Id} />
<Text numberOfLines={2} className="mt-2">
{item.Name}
</Text>
</TouchableOpacity>
</TouchableItemRouter>
)}
/>
)}

View File

@@ -1,4 +1,5 @@
import {
Platform,
TouchableOpacity,
TouchableOpacityProps,
View,
@@ -21,7 +22,7 @@ export const HeaderBackButton: React.FC<Props> = ({
}) => {
const router = useRouter();
if (background === "transparent")
if (background === "transparent" && Platform.OS !== "android")
return (
<BlurView
{...props}
@@ -52,7 +53,7 @@ export const HeaderBackButton: React.FC<Props> = ({
className="drop-shadow-2xl"
name="arrow-back"
size={24}
color="#077DF2"
color="white"
/>
</TouchableOpacity>
);

View File

@@ -15,7 +15,6 @@ const routes = [
"albums/[albumId]",
"artists/index",
"artists/[artistId]",
"collections/[collectionId]",
"items/page",
"series/[id]",
];