Skip to content

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

mobile: fix loading pdf screen not showing

Ammar Ahmede1febfae313c
diff --git a/apps/mobile/app/components/dialogs/pdf-preview/index.js b/apps/mobile/app/components/dialogs/pdf-preview/index.js
index a9b8564bb..fb61d9ea3 100644
--- a/apps/mobile/app/components/dialogs/pdf-preview/index.js
+++ b/apps/mobile/app/components/dialogs/pdf-preview/index.js
@@ -108,11 +108,15 @@ const PDFPreview = () => {
setAttachment(attachment);
let hash = attachment.hash;
if (!hash) return;
- if (!exists(hash)) setLoading(true);
+ if (!(await exists(hash))) setLoading(true);
const uri = await downloadAttachment(hash, false, {
silent: true,
cache: true
});
+ if (!(await exists(hash))) {
+ setVisible(false);
+ return;
+ }
const path = `${cacheDir}/${uri}`;
snapshotValue.current = snapshot.current;
setPDFSource("file://" + path);