Skip to content

Commit

Permalink
[#71] Update to open all songs when clicked in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
tekrei committed Feb 6, 2022
1 parent 8ba9ffd commit 4938ada
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Menu = (props) => {
<IconDrawerItem
icon={faMusic}
label="Tüm Şarkılar"
onPress={() => navigation.navigate("Playlist")}
onPress={() => navigation.navigate("Playlist", { tabIndex: 0 })}
/>
{/*<IconDrawerItem
onPress={() => navigation.navigate("Albums")}
Expand Down
9 changes: 7 additions & 2 deletions src/screens/playlist.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { ScrollView, Text, View } from "react-native";
import Toast from "react-native-root-toast";
import {
Expand Down Expand Up @@ -28,14 +28,19 @@ import { IconPress, TextInputIcon } from "../components/buttons";
import PromptDialog from "../components/prompt";
import Playlists from "../components/playlists";

export const Playlist = ({ navigation }) => {
export const Playlist = ({ navigation, route }) => {
const [order, setOrder] = useState(0);
const [tabIndex, setTabIndex] = useState(0);
const [filter, setFilter] = useState("");
const [saveDialogVisible, setSaveDialogVisible] = useState(false);
const [openDialogVisible, setOpenDialogVisible] = useState(false);
const { playlist, setPlaylist, loop, setLoop, songs } = useAppContext();

useEffect(() => {
if (tabIndex !== route.params?.tabIndex)
setTabIndex(route.params?.tabIndex);
}, [route.params]);

const toggleSong = ({ name, no }) => {
if (playlist.list.find((n) => n === no)) {
setPlaylist({
Expand Down

0 comments on commit 4938ada

Please sign in to comment.