Skip to content

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

mobile: fix note preview is blank

ammarahm-ed9f3a2f4978ab
diff --git a/apps/mobile/app/components/merge-conflicts/index.js b/apps/mobile/app/components/merge-conflicts/index.js
index ac4ff4971..35a0824a0 100644
--- a/apps/mobile/app/components/merge-conflicts/index.js
+++ b/apps/mobile/app/components/merge-conflicts/index.js
@@ -37,7 +37,7 @@ import { useThemeStore } from "../../stores/use-theme-store";
import { dHeight } from "../../utils";
import { eOnLoadNote, eShowMergeDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
-import { timeConverter } from "../../utils/time";
+import { sleep, timeConverter } from "../../utils/time";
import BaseDialog from "../dialog/base-dialog";
import DialogButtons from "../dialog/dialog-buttons";
import DialogContainer from "../dialog/dialog-container";
@@ -313,9 +313,10 @@ const MergeConflicts = () => {
noToolbar
readonly
editorId=":conflictPrimary"
- onLoad={() => {
+ onLoad={async () => {
const note = db.notes.note(content.current?.noteId)?.data;
if (!note) return;
+ await sleep(300);
eSendEvent(eOnLoadNote + ":conflictPrimary", {
...note,
content: {
@@ -347,9 +348,10 @@ const MergeConflicts = () => {
noToolbar
readonly
editorId=":conflictSecondary"
- onLoad={() => {
+ onLoad={async () => {
const note = db.notes.note(content.current?.noteId)?.data;
if (!note) return;
+ await sleep(300);
eSendEvent(eOnLoadNote + ":conflictSecondary", {
...note,
content: { ...content.current.conflicted, isPreview: true }
diff --git a/apps/mobile/app/components/note-history/preview.js b/apps/mobile/app/components/note-history/preview.js
index 1a4d0c1ad..f3bf82dcc 100644
--- a/apps/mobile/app/components/note-history/preview.js
+++ b/apps/mobile/app/components/note-history/preview.js
@@ -28,6 +28,7 @@ import Navigation from "../../services/navigation";
import { useEditorStore } from "../../stores/use-editor-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { eCloseProgressDialog, eOnLoadNote } from "../../utils/events";
+import { sleep } from "../../utils/time";
import DialogHeader from "../dialog/dialog-header";
import { Button } from "../ui/button";
import Paragraph from "../ui/typography/paragraph";
@@ -71,15 +72,20 @@ export default function NotePreview({ session, content }) {
>
<DialogHeader padding={12} title={session.session} />
{!session.locked ? (
- <>
+ <View
+ style={{
+ flex: 1
+ }}
+ >
<EditorOverlay editorId={editorId} />
<Editor
noHeader
noToolbar
readonly
editorId={editorId}
- onLoad={() => {
+ onLoad={async () => {
const note = db.notes.note(session.noteId)?.data;
+ await sleep(300);
eSendEvent(eOnLoadNote + editorId, {
...note,
content: {
@@ -89,7 +95,7 @@ export default function NotePreview({ session, content }) {
});
}}
/>
- </>
+ </View>
) : (
<View
style={{