From 4dc8afb9d5d2ceb9c901877c8f1b100bb8ef0758 Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Wed, 13 Mar 2024 21:45:42 -0400 Subject: [PATCH] Fix PDF generation Share call. --- .../PublicLinkScreen/PublicLinkScreen.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/screens/PublicLinkScreen/PublicLinkScreen.tsx b/app/screens/PublicLinkScreen/PublicLinkScreen.tsx index 7c495977..77bc141f 100644 --- a/app/screens/PublicLinkScreen/PublicLinkScreen.tsx +++ b/app/screens/PublicLinkScreen/PublicLinkScreen.tsx @@ -44,13 +44,15 @@ export default function PublicLinkScreen ({ navigation, route }: PublicLinkScree useEffect(() => { const fetchData = async () => { - const raw_pdf = await convertSVGtoPDF(credential); - setPdf(raw_pdf); - console.log('---------'); - console.log(raw_pdf); - console.log(typeof(raw_pdf)); - console.log('---------'); - if (raw_pdf !== null) { + let rawPdf; + try { + rawPdf = await convertSVGtoPDF(credential); + setPdf(rawPdf); + } catch (e) { + console.log('ERROR GENERATING PDF:'); + console.log(e); + } + if (rawPdf !== null) { setShowExportToPdfButton(true); } }; @@ -74,7 +76,7 @@ export default function PublicLinkScreen ({ navigation, route }: PublicLinkScree const handleShareAsPdf = async() => { if (pdf) { - Share.open({url: `file://${pdf.filepath}`}); + Share.open({url: `file://${pdf.filePath}`}); } };