From 61e852d963fb04b13b7bda39830e208a648b3545 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 13 Mar 2024 16:51:42 +0000 Subject: fix(mobile): Multiple attempts to stop the duplication sharing --- packages/mobile/app/sharing.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'packages/mobile/app/sharing.tsx') diff --git a/packages/mobile/app/sharing.tsx b/packages/mobile/app/sharing.tsx index 59c6fc25..64bbd933 100644 --- a/packages/mobile/app/sharing.tsx +++ b/packages/mobile/app/sharing.tsx @@ -1,5 +1,5 @@ import { Link, useLocalSearchParams, useRouter } from "expo-router"; -import { ShareIntent } from "expo-share-intent"; +import { ShareIntent, useShareIntent } from "expo-share-intent"; import { useEffect, useMemo, useState } from "react"; import { View, Text } from "react-native"; import { z } from "zod"; @@ -12,6 +12,9 @@ type Mode = | { type: "error" }; function SaveBookmark({ setMode }: { setMode: (mode: Mode) => void }) { + // Desperate attempt to fix sharing duplication + const { hasShareIntent, resetShareIntent } = useShareIntent(); + const params = useLocalSearchParams(); const shareIntent = useMemo(() => { @@ -36,6 +39,9 @@ function SaveBookmark({ setMode }: { setMode: (mode: Mode) => void }) { mutate({ type: "text", text: shareIntent.text }); } } + if (hasShareIntent) { + resetShareIntent(); + } }, []); const { mutate, isPending } = api.bookmarks.createBookmark.useMutation({ -- cgit v1.2.3-70-g09d2