|
1 |
| -import React, { useState } from "react"; |
| 1 | +import React, { useEffect, useState } from "react"; |
2 | 2 | import { ScrollView, Text, View } from "react-native";
|
3 | 3 | import Toast from "react-native-root-toast";
|
4 | 4 | import {
|
@@ -28,14 +28,19 @@ import { IconPress, TextInputIcon } from "../components/buttons";
|
28 | 28 | import PromptDialog from "../components/prompt";
|
29 | 29 | import Playlists from "../components/playlists";
|
30 | 30 |
|
31 |
| -export const Playlist = ({ navigation }) => { |
| 31 | +export const Playlist = ({ navigation, route }) => { |
32 | 32 | const [order, setOrder] = useState(0);
|
33 | 33 | const [tabIndex, setTabIndex] = useState(0);
|
34 | 34 | const [filter, setFilter] = useState("");
|
35 | 35 | const [saveDialogVisible, setSaveDialogVisible] = useState(false);
|
36 | 36 | const [openDialogVisible, setOpenDialogVisible] = useState(false);
|
37 | 37 | const { playlist, setPlaylist, loop, setLoop, songs } = useAppContext();
|
38 | 38 |
|
| 39 | + useEffect(() => { |
| 40 | + if (tabIndex !== route.params?.tabIndex) |
| 41 | + setTabIndex(route.params?.tabIndex); |
| 42 | + }, [route.params]); |
| 43 | + |
39 | 44 | const toggleSong = ({ name, no }) => {
|
40 | 45 | if (playlist.list.find((n) => n === no)) {
|
41 | 46 | setPlaylist({
|
|
0 commit comments