Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix tag suggestions in share widget (#2354)

Ammar Ahmed2197f1ec5e77
diff --git a/apps/mobile/share/search.js b/apps/mobile/share/search.js
index c8c535d91..590dc92b8 100644
--- a/apps/mobile/share/search.js
+++ b/apps/mobile/share/search.js
@@ -17,23 +17,22 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+import { FlashList } from "@shopify/flash-list";
import React, { useEffect, useRef, useState } from "react";
import {
- ActivityIndicator,
Platform,
StatusBar,
Text,
TextInput,
TouchableOpacity,
- useWindowDimensions,
- View
+ View,
+ useWindowDimensions
} from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import { db } from "../app/common/database";
import { getElevation } from "../app/utils";
import { useShareStore } from "./store";
-import { FlashList } from "@shopify/flash-list";
const ListItem = ({ item, mode, close }) => {
const colors = useShareStore((state) => state.colors);
@@ -338,7 +337,13 @@ export const Search = ({ close, getKeyboardHeight, quicknote, mode }) => {
renderItem={renderItem}
estimatedItemSize={50}
ListHeaderComponent={
- searchResults.length === 0 && searchKeyword.current ? (
+ mode === "selectTags" &&
+ (searchResults.length === 0 ||
+ (searchKeyword.current &&
+ searchKeyword.current.length > 0 &&
+ !searchResults.find(
+ (item) => item.title === searchKeyword.current
+ ))) ? (
<ListItem
item={{
type: "tag",