diff --git a/components/ItemDetail/component.tsx b/components/ItemDetail/component.tsx index 9702d413..692403d9 100644 --- a/components/ItemDetail/component.tsx +++ b/components/ItemDetail/component.tsx @@ -11,10 +11,12 @@ import FavoriteButton from "../Global/components/favorite-button"; export default function ItemDetail({ item, - navigation + navigation, + onNavigate } : { item: BaseItemDto, - navigation: NativeStackNavigationProp + navigation: NativeStackNavigationProp, + 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] }); diff --git a/components/ItemDetail/helpers/TrackOptions.tsx b/components/ItemDetail/helpers/TrackOptions.tsx index 55cb3ea2..eac5635d 100644 --- a/components/ItemDetail/helpers/TrackOptions.tsx +++ b/components/ItemDetail/helpers/TrackOptions.tsx @@ -10,7 +10,8 @@ export default function TrackOptions({ navigation } : { item: BaseItemDto, - navigation: NativeStackNavigationProp + navigation: NativeStackNavigationProp, + onNavigate?: () => void | undefined }) : React.JSX.Element { const { data: album, isSuccess } = useItem(item.AlbumId ?? "") diff --git a/components/ItemDetail/screen.tsx b/components/ItemDetail/screen.tsx index 91021ba6..a6cd2fc1 100644 --- a/components/ItemDetail/screen.tsx +++ b/components/ItemDetail/screen.tsx @@ -6,15 +6,18 @@ import React from "react"; export default function DetailsScreen({ route, - navigation + navigation, + onNavigate, } : { route: RouteProp, navigation: NativeStackNavigationProp + onNavigate?: () => void | undefined }) : React.JSX.Element { return ( ) } \ No newline at end of file diff --git a/components/Player/screens/index.tsx b/components/Player/screens/index.tsx index 504a00cc..627ff930 100644 --- a/components/Player/screens/index.tsx +++ b/components/Player/screens/index.tsx @@ -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(); + } }); }} /> diff --git a/components/types.tsx b/components/types.tsx index 749143f6..d8d797ad 100644 --- a/components/types.tsx +++ b/components/types.tsx @@ -34,7 +34,8 @@ export type StackParamList = { playlist: BaseItemDto }; Details: { - item: BaseItemDto + item: BaseItemDto, + onNavigate?: () => void | undefined } }