Skip to content

Commit d5acf56

Browse files
committed
[#71] Update to open all songs when clicked in menu
1 parent 7930da9 commit d5acf56

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const Menu = (props) => {
3838
<IconDrawerItem
3939
icon={faMusic}
4040
label="Tüm Şarkılar"
41-
onPress={() => navigation.navigate("Playlist")}
41+
onPress={() => navigation.navigate("Playlist", { tabIndex: 0 })}
4242
/>
4343
{/*<IconDrawerItem
4444
onPress={() => navigation.navigate("Albums")}

src/screens/playlist.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from "react";
1+
import React, { useEffect, useState } from "react";
22
import { ScrollView, Text, View } from "react-native";
33
import Toast from "react-native-root-toast";
44
import {
@@ -28,14 +28,19 @@ import { IconPress, TextInputIcon } from "../components/buttons";
2828
import PromptDialog from "../components/prompt";
2929
import Playlists from "../components/playlists";
3030

31-
export const Playlist = ({ navigation }) => {
31+
export const Playlist = ({ navigation, route }) => {
3232
const [order, setOrder] = useState(0);
3333
const [tabIndex, setTabIndex] = useState(0);
3434
const [filter, setFilter] = useState("");
3535
const [saveDialogVisible, setSaveDialogVisible] = useState(false);
3636
const [openDialogVisible, setOpenDialogVisible] = useState(false);
3737
const { playlist, setPlaylist, loop, setLoop, songs } = useAppContext();
3838

39+
useEffect(() => {
40+
if (tabIndex !== route.params?.tabIndex)
41+
setTabIndex(route.params?.tabIndex);
42+
}, [route.params]);
43+
3944
const toggleSong = ({ name, no }) => {
4045
if (playlist.list.find((n) => n === no)) {
4146
setPlaylist({

0 commit comments

Comments
 (0)