diff --git a/src/libs/fileDownload/index.ios.ts b/src/libs/fileDownload/index.ios.ts index fb2e1c2c146a..10695dacd658 100644 --- a/src/libs/fileDownload/index.ios.ts +++ b/src/libs/fileDownload/index.ios.ts @@ -2,6 +2,7 @@ import {CameraRoll} from '@react-native-camera-roll/camera-roll'; import type {PhotoIdentifier} from '@react-native-camera-roll/camera-roll'; import RNFetchBlob from 'react-native-blob-util'; import RNFS from 'react-native-fs'; +import Share from 'react-native-share'; import CONST from '@src/CONST'; import * as FileUtils from './FileUtils'; import type {FileDownload} from './types'; @@ -47,15 +48,13 @@ const postDownloadFile = (url: string, fileName?: string, formData?: FormData, o .then((fileData) => { const finalFileName = FileUtils.appendTimeToFileName(fileName ?? 'Expensify'); const expensifyDir = `${RNFS.DocumentDirectoryPath}/Expensify`; - + const localPath = `${expensifyDir}/${finalFileName}`; return RNFS.mkdir(expensifyDir).then(() => { - const localPath = `${expensifyDir}/${finalFileName}`; - return RNFS.writeFile(localPath, fileData, 'utf8').then(() => localPath); + return RNFS.writeFile(localPath, fileData, 'utf8') + .then(() => Share.open({url: localPath, failOnCancel: false, saveToFiles: true})) + .then(() => RNFS.unlink(localPath)); }); }) - .then(() => { - FileUtils.showSuccessAlert(); - }) .catch(() => { if (!onDownloadFailed) { FileUtils.showGeneralErrorAlert();