mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-26 04:58:43 -06:00
navigation changes
This commit is contained in:
@@ -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]
|
||||
});
|
||||
|
||||
@@ -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 ?? "")
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -34,7 +34,8 @@ export type StackParamList = {
|
||||
playlist: BaseItemDto
|
||||
};
|
||||
Details: {
|
||||
item: BaseItemDto
|
||||
item: BaseItemDto,
|
||||
onNavigate?: () => void | undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user