navigation changes

This commit is contained in:
Violet Caulfield
2025-01-24 05:10:27 -06:00
parent 2cc50496ed
commit 97883d606f
5 changed files with 22 additions and 8 deletions

View File

@@ -11,10 +11,12 @@ import FavoriteButton from "../Global/components/favorite-button";
export default function ItemDetail({
item,
navigation
navigation,
onNavigate
} : {
item: BaseItemDto,
navigation: NativeStackNavigationProp<StackParamList>
navigation: NativeStackNavigationProp<StackParamList>,
onNavigate?: () => void | undefined
}) : React.JSX.Element {
let options: React.JSX.Element | undefined = undefined;
@@ -23,7 +25,7 @@ export default function ItemDetail({
switch (item.Type) {
case "Audio": {
options = TrackOptions({ item, navigation });
options = TrackOptions({ item, navigation, onNavigate });
break;
}
@@ -69,7 +71,11 @@ export default function ItemDetail({
color={Colors.Primary}
onPress={() => {
if (item.ArtistItems) {
navigation.goBack(); // Dismiss modal if exists
if (onNavigate)
onNavigate();
navigation.goBack();
navigation.push("Artist", {
artist: item.ArtistItems[0]
});

View File

@@ -10,7 +10,8 @@ export default function TrackOptions({
navigation
} : {
item: BaseItemDto,
navigation: NativeStackNavigationProp<StackParamList>
navigation: NativeStackNavigationProp<StackParamList>,
onNavigate?: () => void | undefined
}) : React.JSX.Element {
const { data: album, isSuccess } = useItem(item.AlbumId ?? "")

View File

@@ -6,15 +6,18 @@ import React from "react";
export default function DetailsScreen({
route,
navigation
navigation,
onNavigate,
} : {
route: RouteProp<StackParamList, "Details">,
navigation: NativeStackNavigationProp<StackParamList>
onNavigate?: () => void | undefined
}) : React.JSX.Element {
return (
<ItemDetail
item={route.params.item}
navigation={navigation}
onNavigate={onNavigate}
/>
)
}

View File

@@ -132,7 +132,10 @@ export default function PlayerScreen({ navigation }: { navigation: NativeStackNa
name="dots-horizontal-circle-outline"
onPress={() => {
navigation.navigate("Details", {
item: nowPlaying!.item
item: nowPlaying!.item,
onNavigate: () => {
navigation.goBack();
}
});
}}
/>

View File

@@ -34,7 +34,8 @@ export type StackParamList = {
playlist: BaseItemDto
};
Details: {
item: BaseItemDto
item: BaseItemDto,
onNavigate?: () => void | undefined
}
}