diff --git a/src/def.d.ts b/src/def.d.ts index d4dda96..0443c74 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -253,6 +253,7 @@ interface FileManager { * @param encoding Set to `base64` in order to encode response */ readFile(path: string, encoding: "base64" | "utf8"): Promise; + saveFileToGallery?(uri: string, fileName: string, fileType: "PNG" | "JPEG"): Promise; /** * Beware! This function has differing functionality on iOS and Android. * @param storageDir Either `cache` or `documents`. diff --git a/src/lib/storage/backends.ts b/src/lib/storage/backends.ts index 8e40ba3..546cb0f 100644 --- a/src/lib/storage/backends.ts +++ b/src/lib/storage/backends.ts @@ -10,7 +10,7 @@ export const createMMKVBackend = (store: string): StorageBackend => ({ export const createFileBackend = (file: string): StorageBackend => { const filePathFixer: (file: string) => string = RN.Platform.select({ default: (f) => f, - ios: (f) => `Documents/${f}`, + ios: (f) => FileManager.saveFileToGallery ? f : `Documents/${f}`, }); let created: boolean;