From 727c7f227037f5e4f013173c07812891a58f1b58 Mon Sep 17 00:00:00 2001 From: Ashok Úradníček Date: Sun, 22 Jun 2025 17:13:47 +0200 Subject: feat(mobile): Add tag clearing functionality to tag list (#1595) --- .../app/dashboard/bookmarks/[slug]/manage_tags.tsx | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'apps/mobile') diff --git a/apps/mobile/app/dashboard/bookmarks/[slug]/manage_tags.tsx b/apps/mobile/app/dashboard/bookmarks/[slug]/manage_tags.tsx index a58ba5fd..38296626 100644 --- a/apps/mobile/app/dashboard/bookmarks/[slug]/manage_tags.tsx +++ b/apps/mobile/app/dashboard/bookmarks/[slug]/manage_tags.tsx @@ -1,5 +1,11 @@ import React, { useMemo } from "react"; -import { Pressable, SectionList, Text, View } from "react-native"; +import { + Pressable, + SectionList, + Text, + TouchableOpacity, + View, +} from "react-native"; import { Stack, useLocalSearchParams } from "expo-router"; import { TailwindResolver } from "@/components/TailwindResolver"; import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView"; @@ -81,6 +87,19 @@ const ListPickerPage = () => { onError, }); + const clearAllTags = () => { + if (optimisticTags.length === 0) return; + + updateTags({ + bookmarkId, + detach: optimisticTags.map((tag) => ({ + tagId: tag.id, + tagName: tag.name, + })), + attach: [], + }); + }; + const optimisticExistingTagIds = useMemo(() => { return new Set(optimisticTags?.map((t) => t.id) ?? []); }, [optimisticTags]); @@ -117,6 +136,16 @@ const ListPickerPage = () => { return { filteredAllTags, filteredOptimisticTags }; }, [search, allTags, optimisticTags, optimisticExistingTagIds]); + const ClearButton = () => ( + + Clear + + ); + if (isAllTagsPending) { return ; } @@ -131,6 +160,7 @@ const ListPickerPage = () => { autoCapitalize: "none", hideWhenScrolling: false, }, + headerRight: () => , }} />