Skip to content

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

mobile: fix glitch when opening note, flickery behaviour

Ammar Ahmed71d9738980bc
diff --git a/apps/mobile/app/components/list-items/note/wrapper.tsx b/apps/mobile/app/components/list-items/note/wrapper.tsx
index 3a01dfad4..fc649365e 100644
--- a/apps/mobile/app/components/list-items/note/wrapper.tsx
+++ b/apps/mobile/app/components/list-items/note/wrapper.tsx
@@ -32,9 +32,11 @@ import { eOnLoadNote, eShowMergeDialog } from "../../../utils/events";
import { fluidTabsRef } from "../../../utils/global-refs";
import { NotebooksWithDateEdited, TagsWithDateEdited } from "@notesnook/common";
+import { useTabStore } from "../../../screens/editor/tiptap/use-tab-store";
+import { editorController } from "../../../screens/editor/tiptap/utils";
+import { RouteParams } from "../../../stores/use-navigation-store";
import NotePreview from "../../note-history/preview";
import SelectionWrapper, { selectItem } from "../selection-wrapper";
-import { RouteParams } from "../../../stores/use-navigation-store";
export const openNote = async (
item: Note,
@@ -63,11 +65,19 @@ export const openNote = async (
component: <NotePreview note={item} content={content} />
});
} else {
+ if (!useTabStore.getState().hasTabForNote(note.id!)) {
+ editorController.current.commands.setLoading(
+ true,
+ useTabStore.getState().currentTab
+ );
+ }
eSendEvent(eOnLoadNote, {
item: note
});
if (!DDS.isTab) {
- fluidTabsRef.current?.goToPage("editor");
+ setTimeout(() => {
+ fluidTabsRef.current?.goToPage("editor");
+ }, 32);
}
}
};
diff --git a/packages/editor-mobile/src/components/editor.tsx b/packages/editor-mobile/src/components/editor.tsx
index 8bf675098..697893636 100644
--- a/packages/editor-mobile/src/components/editor.tsx
+++ b/packages/editor-mobile/src/components/editor.tsx
@@ -285,7 +285,7 @@ const Tiptap = ({
restoreNoteSelection(scrollTop, selection);
}
}, 300);
- }, 1);
+ }, 150);
},
[restoreNoteSelection]
);