diff --git a/apps/mobile/share/search.tsx b/apps/mobile/share/search.tsx index 8bd34d4ed..b6f5d4616 100644 --- a/apps/mobile/share/search.tsx +++ b/apps/mobile/share/search.tsx @@ -39,7 +39,7 @@ import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import create from "zustand"; import { db } from "../app/common/database"; import Paragraph from "../app/components/ui/typography/paragraph"; -import { useDBItem } from "../app/hooks/use-db-item"; +import { useDBItem, useNoteLocked } from "../app/hooks/use-db-item"; import { useNotebook } from "../app/hooks/use-notebook"; import { getElevationStyle } from "../app/utils/elevation"; import { initDatabase, useShareStore } from "./store"; @@ -272,6 +272,7 @@ const ListItem = ({ mode === "appendNote" ? "note" : "tag", items as VirtualizedGrouping ); + const locked = useNoteLocked(mode === "appendNote" ? item?.id : undefined); const { colors } = useThemeColors(); const isSelected = useShareStore((state) => mode === "appendNote" || !item @@ -282,14 +283,15 @@ const ListItem = ({ const set = SearchSetters[mode]; const onSelectItem = async () => { - if ((item as Note)?.locked || !item) { + if (!item) { return; } + if (mode === "appendNote") close?.(); set(item.id); }; - return !item ? null : ( + return locked ? null : ( onSelectItem()} @@ -298,47 +300,50 @@ const ListItem = ({ borderBottomWidth: 1, borderBottomColor: colors.primary.border, justifyContent: "center", - paddingVertical: 12 + paddingVertical: 12, + minHeight: 45 }} > - - {item.type !== "note" ? ( - - ) : null} - + {!item ? null : ( - + ) : null} + + - {item.type === "tag" ? "#" : ""} - {item.title} - + + {item.type === "tag" ? "#" : ""} + {item.title} + + - + )} ); };