diff --git a/src/components/AttachmentPicker/index.native.tsx b/src/components/AttachmentPicker/index.native.tsx index a9999119d9a2..d1c6d387724a 100644 --- a/src/components/AttachmentPicker/index.native.tsx +++ b/src/components/AttachmentPicker/index.native.tsx @@ -1,5 +1,5 @@ import {Str} from 'expensify-common'; -import {manipulateAsync, SaveFormat} from 'expo-image-manipulator'; +import {ImageManipulator, SaveFormat} from 'expo-image-manipulator'; import React, {useCallback, useMemo, useRef, useState} from 'react'; import {Alert, View} from 'react-native'; import RNFetchBlob from 'react-native-blob-util'; @@ -178,23 +178,28 @@ function AttachmentPicker({ .then((isHEIC) => { // react-native-image-picker incorrectly changes file extension without transcoding the HEIC file, so we are doing it manually if we detect HEIC signature if (isHEIC && targetAssetUri) { - manipulateAsync(targetAssetUri, [], {format: SaveFormat.JPEG}) - .then((manipResult) => { - const uri = manipResult.uri; - const convertedAsset = { - uri, - name: uri - .substring(uri.lastIndexOf('/') + 1) - .split('?') - .at(0), - type: 'image/jpeg', - width: manipResult.width, - height: manipResult.height, - }; - - return resolve([convertedAsset]); - }) - .catch((err) => reject(err)); + ImageManipulator.manipulate(targetAssetUri) + .renderAsync() + .then((image) => + image + .saveAsync({format: SaveFormat.JPEG}) + .then((manipResult) => { + const uri = manipResult.uri; + const convertedAsset = { + uri, + name: uri + .substring(uri.lastIndexOf('/') + 1) + .split('?') + .at(0), + type: 'image/jpeg', + width: manipResult.width, + height: manipResult.height, + }; + + return resolve([convertedAsset]); + }) + .catch((err) => reject(err)), + ); } else { return resolve(response.assets); } diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx index f16d1d21432c..ff7659cde473 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx @@ -36,7 +36,7 @@ function VideoRenderer({tnode, key}: VideoRendererProps) { diff --git a/src/components/VideoPlayerPreview/index.tsx b/src/components/VideoPlayerPreview/index.tsx index fb188e593949..484c79638d4f 100644 --- a/src/components/VideoPlayerPreview/index.tsx +++ b/src/components/VideoPlayerPreview/index.tsx @@ -22,7 +22,7 @@ type VideoPlayerPreviewProps = { videoUrl: string; /** reportID of the video */ - reportID: string; + reportID: string | undefined; /** Dimension of a video. */ videoDimensions: VideoDimensions; diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 9cbe853b9bb8..e6b605aad5e6 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -133,7 +133,6 @@ import CONFIG from '@src/CONFIG'; import type {OnboardingAccounting, OnboardingCompanySize} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/NewRoomForm'; import type { @@ -2960,7 +2959,7 @@ function openReportFromDeepLink(url: string) { return; } - Navigation.navigate(route as Route, CONST.NAVIGATION.ACTION_TYPE.PUSH); + Navigation.navigate(route, CONST.NAVIGATION.ACTION_TYPE.PUSH); }; if (isAnonymousUser()) { diff --git a/src/libs/fileDownload/getImageManipulator/index.native.ts b/src/libs/fileDownload/getImageManipulator/index.native.ts index d9d9c17e400f..f78fb1006032 100644 --- a/src/libs/fileDownload/getImageManipulator/index.native.ts +++ b/src/libs/fileDownload/getImageManipulator/index.native.ts @@ -1,13 +1,17 @@ -import {manipulateAsync} from 'expo-image-manipulator'; +import {ImageManipulator} from 'expo-image-manipulator'; import type {FileObject} from '@pages/media/AttachmentModalScreen/types'; import type ImageManipulatorConfig from './type'; export default function getImageManipulator({fileUri, width, height, type, fileName}: ImageManipulatorConfig): Promise { - return manipulateAsync(fileUri ?? '', [{resize: {width, height}}]).then((result) => ({ - uri: result.uri, - width: result.width, - height: result.height, - type, - name: fileName, - })); + return ImageManipulator.manipulate(fileUri ?? '') + .resize({width, height}) + .renderAsync() + .then((image) => image.saveAsync()) + .then((result) => ({ + uri: result.uri, + width: result.width, + height: result.height, + type, + name: fileName, + })); } diff --git a/src/libs/fileDownload/getImageManipulator/index.ts b/src/libs/fileDownload/getImageManipulator/index.ts index 87319978caa8..d9743c23d9cc 100644 --- a/src/libs/fileDownload/getImageManipulator/index.ts +++ b/src/libs/fileDownload/getImageManipulator/index.ts @@ -1,14 +1,18 @@ -import {manipulateAsync} from 'expo-image-manipulator'; +import {ImageManipulator} from 'expo-image-manipulator'; import type ImageManipulatorConfig from './type'; export default function getImageManipulator({fileUri, width, height, fileName}: ImageManipulatorConfig): Promise { - return manipulateAsync(fileUri ?? '', [{resize: {width, height}}]).then((result) => - fetch(result.uri) - .then((res) => res.blob()) - .then((blob) => { - const resizedFile = new File([blob], `${fileName}.jpeg`, {type: 'image/jpeg'}); - resizedFile.uri = URL.createObjectURL(resizedFile); - return resizedFile; - }), - ); + return ImageManipulator.manipulate(fileUri ?? '') + .resize({width, height}) + .renderAsync() + .then((image) => image.saveAsync()) + .then((result) => + fetch(result.uri) + .then((res) => res.blob()) + .then((blob) => { + const resizedFile = new File([blob], `${fileName}.jpeg`, {type: 'image/jpeg'}); + resizedFile.uri = URL.createObjectURL(resizedFile); + return resizedFile; + }), + ); }