Skip to content

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

mobile: fix export sheet closable during export

ammarahm-edbe372e711c7c
diff --git a/apps/mobile/app/components/sheet-provider/index.js b/apps/mobile/app/components/sheet-provider/index.js
index c65980143..d9fe26149 100644
--- a/apps/mobile/app/components/sheet-provider/index.js
+++ b/apps/mobile/app/components/sheet-provider/index.js
@@ -153,7 +153,15 @@ const SheetProvider = ({ context = "global" }) => {
</View>
{typeof dialogData.component === "function"
- ? dialogData.component(actionSheetRef, close)
+ ? dialogData.component(actionSheetRef, close, (data) => {
+ if (!data) return;
+ setDialogData((prevData) => {
+ return {
+ ...prevData,
+ ...data
+ };
+ });
+ })
: dialogData.component}
<View
diff --git a/apps/mobile/app/components/sheets/export-notes/index.js b/apps/mobile/app/components/sheets/export-notes/index.js
index 01ffd9f05..86fcb472a 100644
--- a/apps/mobile/app/components/sheets/export-notes/index.js
+++ b/apps/mobile/app/components/sheets/export-notes/index.js
@@ -41,7 +41,7 @@ import Seperator from "../../ui/seperator";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
-const ExportNotesSheet = ({ notes }) => {
+const ExportNotesSheet = ({ notes, update }) => {
const colors = useThemeStore((state) => state.colors);
const [exporting, setExporting] = useState(false);
const [complete, setComplete] = useState(false);
@@ -53,6 +53,7 @@ const ExportNotesSheet = ({ notes }) => {
if (exporting) return;
if (!PremiumService.get() && type !== "txt") return;
setExporting(true);
+ update({ disableClosing: true });
setComplete(false);
let result;
if (notes.length > 1) {
@@ -62,10 +63,11 @@ const ExportNotesSheet = ({ notes }) => {
await sleep(1000);
}
if (!result) {
+ update({ disableClosing: false });
return setExporting(false);
}
-
setResult(result);
+ update({ disableClosing: false });
setComplete(true);
setExporting(false);
};
@@ -325,7 +327,12 @@ const ExportNotesSheet = ({ notes }) => {
ExportNotesSheet.present = (notes, allNotes) => {
presentSheet({
- component: <ExportNotesSheet notes={allNotes ? db.notes.all : notes} />
+ component: (ref, close, update) => (
+ <ExportNotesSheet
+ notes={allNotes ? db.notes.all : notes}
+ update={update}
+ />
+ )
});
};