mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 18:13:25 +00:00
chore: toast for bookmark
This commit is contained in:
@@ -3,6 +3,7 @@ import type { ContextMenuOnPressNativeEvent } from "react-native-context-menu-vi
|
|||||||
import { Keyboard, TouchableOpacity } from "react-native";
|
import { Keyboard, TouchableOpacity } from "react-native";
|
||||||
import ContextMenu from "react-native-context-menu-view";
|
import ContextMenu from "react-native-context-menu-view";
|
||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
|
import { useToastController } from "@tamagui/toast";
|
||||||
import { Image, Text, View } from "tamagui";
|
import { Image, Text, View } from "tamagui";
|
||||||
|
|
||||||
import { usePlayerStore } from "~/stores/player/store";
|
import { usePlayerStore } from "~/stores/player/store";
|
||||||
@@ -18,6 +19,7 @@ export interface ItemData {
|
|||||||
export default function Item({ data }: { data: ItemData }) {
|
export default function Item({ data }: { data: ItemData }) {
|
||||||
const resetVideo = usePlayerStore((state) => state.resetVideo);
|
const resetVideo = usePlayerStore((state) => state.resetVideo);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const toastController = useToastController();
|
||||||
|
|
||||||
const { title, type, year, posterUrl } = data;
|
const { title, type, year, posterUrl } = data;
|
||||||
|
|
||||||
@@ -38,7 +40,12 @@ export default function Item({ data }: { data: ItemData }) {
|
|||||||
const onContextMenuPress = (
|
const onContextMenuPress = (
|
||||||
e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>,
|
e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>,
|
||||||
) => {
|
) => {
|
||||||
if (e.nativeEvent.name === "Download") {
|
if (e.nativeEvent.name === "Bookmark") {
|
||||||
|
toastController.show("Added to bookmarks", {
|
||||||
|
burntOptions: { preset: "done" },
|
||||||
|
native: true,
|
||||||
|
});
|
||||||
|
} else if (e.nativeEvent.name === "Download") {
|
||||||
router.push({
|
router.push({
|
||||||
pathname: "/videoPlayer",
|
pathname: "/videoPlayer",
|
||||||
params: { data: JSON.stringify(data), download: "true" },
|
params: { data: JSON.stringify(data), download: "true" },
|
||||||
|
Reference in New Issue
Block a user