diff --git a/apps/mobile/app/components/sheets/link-note/index.tsx b/apps/mobile/app/components/sheets/link-note/index.tsx index 7d97d2828..8e4a67323 100644 --- a/apps/mobile/app/components/sheets/link-note/index.tsx +++ b/apps/mobile/app/components/sheets/link-note/index.tsx @@ -28,7 +28,7 @@ import { NativeEvents } from "@notesnook/editor-mobile/src/utils/native-events"; import { strings } from "@notesnook/intl"; import { useThemeColors } from "@notesnook/theme"; import React, { useEffect, useRef, useState } from "react"; -import { TextInput, View } from "react-native"; +import { ActivityIndicator, TextInput, View } from "react-native"; import { FlatList } from "react-native-actions-sheet"; import { db } from "../../../common/database"; import { useDBItem } from "../../../hooks/use-db-item"; @@ -118,8 +118,8 @@ const ListBlockItem = ({ {item?.content.length > 200 ? item?.content.slice(0, 200) + "..." : !item.content || item.content.trim() === "" - ? strings.linkNoteEmptyBlock() - : item.content} + ? strings.linkNoteEmptyBlock() + : item.content} (); const [selectedNodeId, setSelectedNodeId] = useState(); + const [blocksLoading, setBlocksLoading] = useState(false); useEffect(() => { db.notes.all.sorted(db.settings.getGroupOptions("notes")).then((notes) => { @@ -206,10 +207,12 @@ export default function LinkNote(props: { const onSelectNote = async (note: Note) => { setSelectedNote(note); + setBlocksLoading(true); inputRef.current?.clear(); setTimeout(async () => { nodesRef.current = await db.notes.contentBlocks(note.id); setNodes(nodesRef.current); + setBlocksLoading(false); }); // Fetch and set note's nodes. }; @@ -330,28 +333,32 @@ export default function LinkNote(props: { windowSize={3} keyExtractor={(item) => item.id} ListEmptyComponent={ - - - {blockLinking?.error} - -