[Hotfix] Fix filePathFixer for iOS 174.0 and later
This commit is contained in:
parent
361b541ddc
commit
4e1df66cc1
2 changed files with 2 additions and 1 deletions
1
src/def.d.ts
vendored
1
src/def.d.ts
vendored
|
@ -253,6 +253,7 @@ interface FileManager {
|
||||||
* @param encoding Set to `base64` in order to encode response
|
* @param encoding Set to `base64` in order to encode response
|
||||||
*/
|
*/
|
||||||
readFile(path: string, encoding: "base64" | "utf8"): Promise<string>;
|
readFile(path: string, encoding: "base64" | "utf8"): Promise<string>;
|
||||||
|
saveFileToGallery?(uri: string, fileName: string, fileType: "PNG" | "JPEG"): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* Beware! This function has differing functionality on iOS and Android.
|
* Beware! This function has differing functionality on iOS and Android.
|
||||||
* @param storageDir Either `cache` or `documents`.
|
* @param storageDir Either `cache` or `documents`.
|
||||||
|
|
|
@ -10,7 +10,7 @@ export const createMMKVBackend = (store: string): StorageBackend => ({
|
||||||
export const createFileBackend = (file: string): StorageBackend => {
|
export const createFileBackend = (file: string): StorageBackend => {
|
||||||
const filePathFixer: (file: string) => string = RN.Platform.select({
|
const filePathFixer: (file: string) => string = RN.Platform.select({
|
||||||
default: (f) => f,
|
default: (f) => f,
|
||||||
ios: (f) => `Documents/${f}`,
|
ios: (f) => FileManager.saveFileToGallery ? f : `Documents/${f}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
let created: boolean;
|
let created: boolean;
|
||||||
|
|
Loading…
Reference in a new issue