Repository: Expensify/App
Pull request #59363: [Pre RN 0.79] Migrate documents picker
Author: login: war-in
Labels: name: Ready To Build
Created: 2025-03-31T14:12:26Z | Merged: 2025-04-21T21:19:39Z

<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Explanation of Change
<!-- Explain what your change does and how it addresses the linked issue -->

I'm working on RN 0.78 support https://github.com/Expensify/App/pull/58914 and I found out that the `@react-native-document-picker` has to be bumped because it supports React Native 0.78 since 10.x.x

### Fixed Issues
<!---
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix  `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify).  For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`

Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.

Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):

$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>

Do NOT only link the issue number like this: $ #<issueID>
--->
$ https://github.com/Expensify/App/issues/57511
PROPOSAL:
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13510


<!--- 
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please link it like this:

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/<PR-number>

--->

### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Add any additional test steps if test steps are unique to a particular platform.
Manual test steps should be written so that your reviewer can repeat and verify one or more expected outcomes in the development environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
--->

1. Open app and verify it runs correctly
2. Go to chat and send attachment
3. Verify that the flow is correct

1. In ios native, select Create Expense
2. Scan and choose image taken on the iphone in gallery (so its the ios heic format)
3. Note you have to choose the image from gallery, taking the picture in the app works fine
4. Create this expense
5. Verify it works

### Offline tests
<!---
Add any relevant steps that validate your changes work as expected in a variety of network states e.g. "offline", "spotty connection", "slow internet", etc. Manual test steps should be written so that your reviewer and QA testers can repeat and verify one or more expected outcomes. If you are unsure how the behavior should work ask for advice in the `#expensify-open-source` Slack channel.
--->

### QA Steps
<!---
Add a numbered list of manual tests that can be performed by our QA engineers on the staging environment to validate that your changes work on all platforms, and that there are no regressions present.
Add any additional QA steps if test steps are unique to a particular platform.
Manual test steps should be written so that the QA engineer can repeat and verify one or more expected outcomes in the staging environment.

For example:
1. Click on the text input to bring it into focus
5. Upload an image via copy paste
6. Verify a modal appears displaying a preview of that image

It's acceptable to write "Same as tests" if the QA team is able to run the tests in the above "Tests" section.
--->

1. Open app and verify it runs correctly
2. Go to chat and send attachment
3. Verify that the flow is correct

1. In ios native, select Create Expense
2. Scan and choose image taken on the iphone in gallery (so its the ios heic format)
3. Note you have to choose the image from gallery, taking the picture in the app works fine
4. Create this expense
5. Verify it works

### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->

- [x] I linked the correct issue in the `### Fixed Issues` section above
- [x] I wrote clear testing steps that cover the changes made in this PR
  - [x] I added steps for local testing in the `Tests` section
  - [x] I added steps for the expected offline behavior in the `Offline steps` section
  - [x] I added steps for Staging and/or Production testing in the `QA steps` section
  - [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
  - [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  - [x] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I ran the tests on **all platforms** & verified they passed on:
  - [x] Android: Native
  - [x] Android: mWeb Chrome
  - [x] iOS: Native
  - [x] iOS: mWeb Safari
  - [x] MacOS: Chrome / Safari
  - [x] MacOS: Desktop
- [x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [x] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
  - [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
  - [x] I verified that comments were added to code that is not self explanatory
  - [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
  - [x] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60)
    - [x] If any non-english text was added/modified, I used [JaimeGPT](https://chatgpt.com/g/g-2dgOQl5VM-english-to-spanish-translator-aka-jaimegpt) to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
  - [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60-L68)
  - [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  - [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
  - [x] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [x] I verified that if a function's arguments changed that all usages have also been updated correctly
- [x] If any new file was added I verified that:
  - [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [x] If a new CSS style is added I verified that:
  - [x] A similar style doesn't already exist
  - [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
  - [x] I verified that all the inputs inside a form are aligned with each other.
  - [x] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [x] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [x] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [x] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.

### Screenshots/Videos
<details>
<summary>Android: Native</summary>

<!-- add screenshots or videos here -->

https://github.com/user-attachments/assets/b223bcb6-0d77-492e-b00d-6fc4a524161e

</details>

<details>
<summary>Android: mWeb Chrome</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: Native</summary>

<!-- add screenshots or videos here -->

https://github.com/user-attachments/assets/8c9413a9-745c-48b1-8876-9bceffc2c190


</details>

<details>
<summary>iOS: mWeb Safari</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>MacOS: Chrome / Safari</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>MacOS: Desktop</summary>

<!-- add screenshots or videos here -->

</details>


Diff:
diff --git a/__mocks__/@react-native-documents/picker.ts b/__mocks__/@react-native-documents/picker.ts
new file mode 100644
index 000000000000..37e9303b64a7
--- /dev/null
+++ b/__mocks__/@react-native-documents/picker.ts
@@ -0,0 +1,24 @@
+import type {FileToCopy} from '@react-native-documents/picker';
+
+const keepLocalCopy = jest.fn();
+const pick = jest.fn();
+const types = Object.freeze({
+    allFiles: 'public.item',
+    audio: 'public.audio',
+    csv: 'public.comma-separated-values-text',
+    doc: 'com.microsoft.word.doc',
+    docx: 'org.openxmlformats.wordprocessingml.document',
+    images: 'public.image',
+    json: 'public.json',
+    pdf: 'com.adobe.pdf',
+    plainText: 'public.plain-text',
+    ppt: 'com.microsoft.powerpoint.ppt',
+    pptx: 'org.openxmlformats.presentationml.presentation',
+    video: 'public.movie',
+    xls: 'com.microsoft.excel.xls',
+    xlsx: 'org.openxmlformats.spreadsheetml.sheet',
+    zip: 'public.zip-archive',
+});
+
+export type {FileToCopy};
+export {keepLocalCopy, pick, types};
diff --git a/__mocks__/react-native-document-picker.ts b/__mocks__/react-native-document-picker.ts
deleted file mode 100644
index 524e701f88fc..000000000000
--- a/__mocks__/react-native-document-picker.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import type {pick, pickDirectory, releaseSecureAccess, types} from 'react-native-document-picker';
-
-type ReactNativeDocumentPickerMock = {
-    pick: typeof pick;
-    releaseSecureAccess: typeof releaseSecureAccess;
-    pickDirectory: typeof pickDirectory;
-    types: typeof types;
-};
-
-const reactNativeDocumentPickerMock: ReactNativeDocumentPickerMock = {
-    pick: jest.fn(),
-    releaseSecureAccess: jest.fn(),
-    pickDirectory: jest.fn(),
-    types: Object.freeze({
-        allFiles: 'public.item',
-        audio: 'public.audio',
-        csv: 'public.comma-separated-values-text',
-        doc: 'com.microsoft.word.doc',
-        docx: 'org.openxmlformats.wordprocessingml.document',
-        images: 'public.image',
-        json: 'public.json',
-        pdf: 'com.adobe.pdf',
-        plainText: 'public.plain-text',
-        ppt: 'com.microsoft.powerpoint.ppt',
-        pptx: 'org.openxmlformats.presentationml.presentation',
-        video: 'public.movie',
-        xls: 'com.microsoft.excel.xls',
-        xlsx: 'org.openxmlformats.spreadsheetml.sheet',
-        zip: 'public.zip-archive',
-    }),
-};
-
-export default reactNativeDocumentPickerMock;
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index de1d6addb24d..65d343ee5124 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -1714,7 +1714,7 @@ PODS:
     - ReactCommon/turbomodule/bridging
     - ReactCommon/turbomodule/core
     - Yoga
-  - react-native-document-picker (9.3.1):
+  - react-native-document-picker (10.1.1):
     - DoubleConversion
     - glog
     - hermes-engine
@@ -2991,7 +2991,7 @@ DEPENDENCIES:
   - react-native-blob-util (from `../node_modules/react-native-blob-util`)
   - "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)"
   - react-native-config (from `../node_modules/react-native-config`)
-  - react-native-document-picker (from `../node_modules/react-native-document-picker`)
+  - "react-native-document-picker (from `../node_modules/@react-native-documents/picker`)"
   - "react-native-geolocation (from `../node_modules/@react-native-community/geolocation`)"
   - react-native-image-picker (from `../node_modules/react-native-image-picker`)
   - react-native-key-command (from `../node_modules/react-native-key-command`)
@@ -3227,7 +3227,7 @@ EXTERNAL SOURCES:
   react-native-config:
     :path: "../node_modules/react-native-config"
   react-native-document-picker:
-    :path: "../node_modules/react-native-document-picker"
+    :path: "../node_modules/@react-native-documents/picker"
   react-native-geolocation:
     :path: "../node_modules/@react-native-community/geolocation"
   react-native-image-picker:
@@ -3469,7 +3469,7 @@ SPEC CHECKSUMS:
   react-native-blob-util: d65692a2acce17b7a836805114828142a3634033
   react-native-cameraroll: 78710a5d35b0c6f41899a193e714564d8fd648b0
   react-native-config: 5b9e180ca7beb5748ba473b257bb9a7d10e2a957
-  react-native-document-picker: da64a39fd71a84a9d3f7f58c8b0623c393e9991c
+  react-native-document-picker: 5cb1c6615796389f4f1b7fe2e4f103e38e4d6398
   react-native-geolocation: cd91e4fd914de585933c836fd71f6bdb3c97a410
   react-native-image-picker: 9e419813377d42566b0168121ab9483614488db5
   react-native-key-command: 96c9dfb09bc89ecd1d58348c0d3ed84d0255648b
diff --git a/package-lock.json b/package-lock.json
index 669cf937f4bd..aa8f3a451941 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -33,6 +33,7 @@
         "@react-native-clipboard/clipboard": "^1.15.0",
         "@react-native-community/geolocation": "3.3.0",
         "@react-native-community/netinfo": "11.2.1",
+        "@react-native-documents/picker": "^10.1.1",
         "@react-native-firebase/analytics": "^12.3.0",
         "@react-native-firebase/app": "^12.3.0",
         "@react-native-firebase/crashlytics": "^12.3.0",
@@ -92,7 +93,6 @@
         "react-native-collapsible": "^1.6.2",
         "react-native-config": "1.5.3",
         "react-native-device-info": "10.3.1",
-        "react-native-document-picker": "^9.3.1",
         "react-native-draggable-flatlist": "^4.0.1",
         "react-native-fs": "^2.20.0",
         "react-native-gesture-handler": "2.22.0",
@@ -9539,6 +9539,16 @@
         "react-native": ">=0.59"
       }
     },
+    "node_modules/@react-native-documents/picker": {
+      "version": "10.1.1",
+      "resolved": "https://registry.npmjs.org/@react-native-documents/picker/-/picker-10.1.1.tgz",
+      "integrity": "sha512-RijOCQmesOPe4ahtwOag6k6GLhLHf34sMQtAJ4KjLk7ab0kG5Chvcsvd5zixWC4d0tuBnVAtMUOzvn0bp+UtAg==",
+      "license": "MIT",
+      "peerDependencies": {
+        "react": "*",
+        "react-native": "*"
+      }
+    },
     "node_modules/@react-native-firebase/analytics": {
       "version": "12.9.3",
       "license": "Apache-2.0",
@@ -32830,24 +32840,6 @@
         "react-native": "*"
       }
     },
-    "node_modules/react-native-document-picker": {
-      "version": "9.3.1",
-      "resolved": "https://registry.npmjs.org/react-native-document-picker/-/react-native-document-picker-9.3.1.tgz",
-      "integrity": "sha512-Vcofv9wfB0j67zawFjfq9WQPMMzXxOZL9kBmvWDpjVuEcVK73ndRmlXHlkeFl5ZHVsv4Zb6oZYhqm9u5omJOPA==",
-      "dependencies": {
-        "invariant": "^2.2.4"
-      },
-      "peerDependencies": {
-        "react": "*",
-        "react-native": "*",
-        "react-native-windows": "*"
-      },
-      "peerDependenciesMeta": {
-        "react-native-windows": {
-          "optional": true
-        }
-      }
-    },
     "node_modules/react-native-draggable-flatlist": {
       "version": "4.0.1",
       "license": "MIT",
diff --git a/package.json b/package.json
index b246fa68a61b..16e2afcb5267 100644
--- a/package.json
+++ b/package.json
@@ -100,6 +100,7 @@
     "@react-native-clipboard/clipboard": "^1.15.0",
     "@react-native-community/geolocation": "3.3.0",
     "@react-native-community/netinfo": "11.2.1",
+    "@react-native-documents/picker": "^10.1.1",
     "@react-native-firebase/analytics": "^12.3.0",
     "@react-native-firebase/app": "^12.3.0",
     "@react-native-firebase/crashlytics": "^12.3.0",
@@ -159,7 +160,6 @@
     "react-native-collapsible": "^1.6.2",
     "react-native-config": "1.5.3",
     "react-native-device-info": "10.3.1",
-    "react-native-document-picker": "^9.3.1",
     "react-native-draggable-flatlist": "^4.0.1",
     "react-native-fs": "^2.20.0",
     "react-native-gesture-handler": "2.22.0",
diff --git a/src/components/AttachmentPicker/index.native.tsx b/src/components/AttachmentPicker/index.native.tsx
index 995442ea9cf2..ada6b2c110f7 100644
--- a/src/components/AttachmentPicker/index.native.tsx
+++ b/src/components/AttachmentPicker/index.native.tsx
@@ -1,10 +1,10 @@
+import type {FileToCopy} from '@react-native-documents/picker';
+import {keepLocalCopy, pick, types} from '@react-native-documents/picker';
 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';
-import RNDocumentPicker from 'react-native-document-picker';
-import type {DocumentPickerOptions, DocumentPickerResponse} from 'react-native-document-picker';
 import {launchImageLibrary} from 'react-native-image-picker';
 import type {Asset, Callback, CameraOptions, ImageLibraryOptions, ImagePickerResponse} from 'react-native-image-picker';
 import ImageSize from 'react-native-image-size';
@@ -19,20 +19,27 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
 import useStyleUtils from '@hooks/useStyleUtils';
 import useTheme from '@hooks/useTheme';
 import useThemeStyles from '@hooks/useThemeStyles';
-import * as FileUtils from '@libs/fileDownload/FileUtils';
+import {cleanFileName, showCameraPermissionsAlert, verifyFileFormat} from '@libs/fileDownload/FileUtils';
 import CONST from '@src/CONST';
 import type {TranslationPaths} from '@src/languages/types';
 import type IconAsset from '@src/types/utils/IconAsset';
 import launchCamera from './launchCamera/launchCamera';
 import type AttachmentPickerProps from './types';
 
+type LocalCopy = {
+    name: string | null;
+    uri: string;
+    size: number | null;
+    type: string | null;
+};
+
 type Item = {
     /** The icon associated with the item. */
     icon: IconAsset;
     /** The key in the translations file to use for the title */
     textTranslationKey: TranslationPaths;
     /** Function to call when the user clicks the item */
-    pickAttachment: () => Promise<Asset[] | void | DocumentPickerResponse[]>;
+    pickAttachment: () => Promise<Asset[] | void | LocalCopy[]>;
 };
 
 /**
@@ -56,28 +63,6 @@ const getImagePickerOptions = (type: string, fileLimit: number): CameraOptions |
     };
 };
 
-/**
- * Return documentPickerOptions based on the type
- * @param {String} type
- * @param {Number} fileLimit
- * @returns {Object}
- */
-
-const getDocumentPickerOptions = (type: string, fileLimit: number): DocumentPickerOptions => {
-    if (type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
-        return {
-            type: [RNDocumentPicker.types.images],
-            copyTo: 'cachesDirectory',
-            allowMultiSelection: fileLimit !== 1,
-        };
-    }
-    return {
-        type: [RNDocumentPicker.types.allFiles],
-        copyTo: 'cachesDirectory',
-        allowMultiSelection: fileLimit !== 1,
-    };
-};
-
 /**
  * The data returned from `show` is different on web and mobile, so use this function to ensure the data we
  * send to the xhr will be handled properly.
@@ -85,7 +70,7 @@ const getDocumentPickerOptions = (type: string, fileLimit: number): DocumentPick
 const getDataForUpload = (fileData: FileResponse): Promise<FileObject> => {
     const fileName = fileData.name || 'chat_attachment';
     const fileResult: FileObject = {
-        name: FileUtils.cleanFileName(fileName),
+        name: cleanFileName(fileName),
         type: fileData.type,
         width: fileData.width,
         height: fileData.height,
@@ -158,7 +143,7 @@ function AttachmentPicker({
                     if (response.errorCode) {
                         switch (response.errorCode) {
                             case 'permission':
-                                FileUtils.showCameraPermissionsAlert();
+                                showCameraPermissionsAlert();
                                 return resolve();
                             default:
                                 showGeneralAlert();
@@ -176,11 +161,13 @@ function AttachmentPicker({
                     }
 
                     if (targetAsset?.type?.startsWith('image')) {
-                        FileUtils.verifyFileFormat({fileUri: targetAssetUri, formatSignatures: CONST.HEIC_SIGNATURES})
+                        verifyFileFormat({fileUri: targetAssetUri, formatSignatures: CONST.HEIC_SIGNATURES})
                             .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})
+                                    ImageManipulator.manipulate(targetAssetUri)
+                                        .renderAsync()
+                                        .then((manipulatedImage) => manipulatedImage.saveAsync({format: SaveFormat.JPEG}))
                                         .then((manipResult) => {
                                             const uri = manipResult.uri;
                                             const convertedAsset = {
@@ -211,21 +198,38 @@ function AttachmentPicker({
     );
     /**
      * Launch the DocumentPicker. Results are in the same format as ImagePicker
-     *
-     * @returns {Promise<DocumentPickerResponse[] | void>}
      */
-    const showDocumentPicker = useCallback(
-        (): Promise<DocumentPickerResponse[] | void> =>
-            RNDocumentPicker.pick(getDocumentPickerOptions(type, fileLimit)).catch((error: Error) => {
-                if (RNDocumentPicker.isCancel(error)) {
-                    return;
-                }
+    // eslint-disable-next-line @lwc/lwc/no-async-await
+    const showDocumentPicker = useCallback(async (): Promise<LocalCopy[]> => {
+        const pickedFiles = await pick({
+            type: [type === CONST.ATTACHMENT_PICKER_TYPE.IMAGE ? types.images : types.allFiles],
+            allowMultiSelection: fileLimit !== 1,
+        });
 
-                showGeneralAlert(error.message);
-                throw error;
-            }),
-        [fileLimit, showGeneralAlert, type],
-    );
+        const localCopies = await keepLocalCopy({
+            files: pickedFiles.map((file) => {
+                return {
+                    uri: file.uri,
+                    fileName: file.name ?? '',
+                };
+            }) as [FileToCopy, ...FileToCopy[]],
+            destination: 'cachesDirectory',
+        });
+
+        return pickedFiles.map((file, index) => {
+            const localCopy = localCopies[index];
+            if (localCopy.status !== 'success') {
+                throw new Error("Couldn't create local file copy");
+            }
+
+            return {
+                name: file.name,
+                uri: localCopy.localUri,
+                size: file.size,
+                type: file.type,
+            };
+        });
+    }, [fileLimit, type]);
 
     const menuItemData: Item[] = useMemo(() => {
         const data: Item[] = [
@@ -309,7 +313,7 @@ function AttachmentPicker({
      * sends the selected attachment to the caller (parent component)
      */
     const pickAttachment = useCallback(
-        (attachments: Asset[] | DocumentPickerResponse[] | void = []): Promise<void[]> | undefined => {
+        (attachments: Asset[] | LocalCopy[] | void = []): Promise<void[]> | undefined => {
             if (!attachments || attachments.length === 0) {
                 onCanceled.current();
                 return Promise.resolve([]);
@@ -323,7 +327,7 @@ function AttachmentPicker({
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
                 const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataUri = ('uri' in fileData && fileData.uri) || '';
 
                 const fileDataObject: FileResponse = {
                     name: fileDataName ?? '',
@@ -397,6 +401,14 @@ function AttachmentPicker({
             onModalHide.current = () => {
                 setTimeout(() => {
                     item.pickAttachment()
+                        .catch((error: Error) => {
+                            if (JSON.stringify(error).includes('OPERATION_CANCELED')) {
+                                return;
+                            }
+
+                            showGeneralAlert(error.message);
+                            throw error;
+                        })
                         .then((result) => pickAttachment(result))
                         .catch(console.error)
                         .finally(() => {
@@ -407,7 +419,7 @@ function AttachmentPicker({
             };
             close();
         },
-        [pickAttachment, onOpenPicker],
+        [onOpenPicker, pickAttachment, showGeneralAlert],
     );
 
     useKeyboardShortcut(
diff --git a/src/components/FilePicker/index.native.tsx b/src/components/FilePicker/index.native.tsx
index 4b381713e44b..9e7b27e10e2d 100644
--- a/src/components/FilePicker/index.native.tsx
+++ b/src/components/FilePicker/index.native.tsx
@@ -1,34 +1,27 @@
+import {keepLocalCopy, pick, types} from '@react-native-documents/picker';
 import React, {useCallback, useRef} from 'react';
 import {Alert} from 'react-native';
 import RNFetchBlob from 'react-native-blob-util';
-import RNDocumentPicker from 'react-native-document-picker';
-import type {DocumentPickerResponse} from 'react-native-document-picker';
 import type {FileObject} from '@components/AttachmentModal';
 import useLocalize from '@hooks/useLocalize';
-import * as FileUtils from '@libs/fileDownload/FileUtils';
+import {cleanFileName} from '@libs/fileDownload/FileUtils';
 import type FilePickerProps from './types';
 
-/**
- * Utility function to get the file name from DocumentPickerResponse
- */
-const getFileDataName = (fileData: DocumentPickerResponse): string => {
-    if ('fileName' in fileData) {
-        return fileData.fileName as string;
-    }
-    if ('name' in fileData && fileData.name) {
-        return fileData.name;
-    }
-    return '';
+type LocalCopy = {
+    name: string | null;
+    uri: string;
+    size: number | null;
+    type: string | null;
 };
 
 /**
  * The data returned from `show` is different on web and mobile,
  * use this function to ensure the data will be handled properly.
  */
-const getDataForUpload = (fileData: DocumentPickerResponse): Promise<FileObject> => {
+const getDataForUpload = (fileData: LocalCopy): Promise<FileObject> => {
     const fileName = fileData.name ?? 'spreadsheet';
     const fileResult: FileObject = {
-        name: FileUtils.cleanFileName(fileName),
+        name: cleanFileName(fileName),
         type: fileData.type ?? undefined,
         uri: fileData.uri,
         size: fileData.size,
@@ -60,35 +53,17 @@ function FilePicker({children}: FilePickerProps) {
         [translate],
     );
 
-    /**
-     * Launches the DocumentPicker
-     *
-     * @returns {Promise<DocumentPickerResponse[] | void>}
-     */
-    const showFilePicker = useCallback(
-        (): Promise<DocumentPickerResponse[] | void> =>
-            RNDocumentPicker.pick({
-                type: [RNDocumentPicker.types.allFiles],
-                copyTo: 'cachesDirectory',
-            }).catch((error: Error) => {
-                if (RNDocumentPicker.isCancel(error)) {
-                    onCanceled.current();
-                    return;
-                }
-
-                showGeneralAlert(error.message);
-                throw error;
-            }),
-        [showGeneralAlert],
-    );
-
     /**
      * Validates and completes file selection
      *
      * @param fileData The file data received from the picker
      */
     const validateAndCompleteFileSelection = useCallback(
-        (fileData: DocumentPickerResponse) => {
+        (fileData: LocalCopy | void) => {
+            if (!fileData) {
+                onCanceled.current();
+                return;
+            }
             return getDataForUpload(fileData)
                 .then((result) => {
                     completeFileSelection.current(result);
@@ -106,34 +81,29 @@ function FilePicker({children}: FilePickerProps) {
      *
      * @param files The array of DocumentPickerResponse
      */
-    const pickFile = useCallback(
-        (files: DocumentPickerResponse[] | void = []): Promise<void> | undefined => {
-            if (!files || files.length === 0) {
-                onCanceled.current();
-                return Promise.resolve();
-            }
-            const fileData = files.at(0);
+    // eslint-disable-next-line @lwc/lwc/no-async-await
+    const pickFile = async (): Promise<LocalCopy> => {
+        const [file] = await pick({
+            type: [types.allFiles],
+        });
 
-            if (!fileData) {
-                onCanceled.current();
-                return Promise.resolve();
-            }
+        const [localCopy] = await keepLocalCopy({
+            files: [
+                {
+                    uri: file.uri,
+                    fileName: file.name ?? 'spreadsheet',
+                },
+            ],
+            destination: 'cachesDirectory',
+        });
 
-            // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
-            const fileDataUri = fileData.fileCopyUri ?? '';
-            const fileDataName = getFileDataName(fileData);
-            const fileDataObject: DocumentPickerResponse = {
-                name: fileDataName,
-                uri: fileDataUri,
-                type: fileData.type ?? '',
-                fileCopyUri: fileDataUri,
-                size: fileData.size ?? 0,
-            };
-            /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
-            validateAndCompleteFileSelection(fileDataObject);
-        },
-        [validateAndCompleteFileSelection],
-    );
+        return {
+            name: cleanFileName(file.name ?? 'spreadsheet'),
+            type: file.type,
+            uri: localCopy.sourceUri,
+            size: file.size,
+        };
+    };
 
     /**
      * Opens the file picker
@@ -141,10 +111,22 @@ function FilePicker({children}: FilePickerProps) {
      * @param onPickedHandler A callback that will be called with the selected file
      * @param onCanceledHandler A callback that will be called if the file is canceled
      */
+    // eslint-disable-next-line @lwc/lwc/no-async-await
     const open = (onPickedHandler: (file: FileObject) => void, onCanceledHandler: () => void = () => {}) => {
         completeFileSelection.current = onPickedHandler;
         onCanceled.current = onCanceledHandler;
-        showFilePicker().then(pickFile).catch(console.error);
+        pickFile()
+            .catch((error: Error) => {
+                if (JSON.stringify(error).includes('OPERATION_CANCELED')) {
+                    onCanceled.current();
+                    return Promise.resolve();
+                }
+
+                showGeneralAlert(error.message);
+                throw error;
+            })
+            .then(validateAndCompleteFileSelection)
+            .catch(console.error);
     };
 
     /**


Reviews:
user: login: shubham1206agra
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-12T17:04:20Z
user: login: war-in
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T11:04:07Z
user: login: shubham1206agra
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T11:18:55Z
user: login: war-in
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T11:24:10Z
user: login: shubham1206agra
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T14:56:03Z
user: login: war-in
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T15:14:10Z
user: login: shubham1206agra
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T15:24:06Z
user: login: shubham1206agra
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T15:29:06Z
user: login: war-in
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T15:30:00Z
user: login: shubham1206agra
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T15:33:17Z
user: login: war-in
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-14T15:44:15Z
user: login: war-in
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-15T11:22:05Z
user: login: shubham1206agra
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-17T12:38:57Z
user: login: mountiny
body: I have tested again on the adhoc build and both creating expense and adding attachment worked fine for me also I could see the images just fine on the build and on staging web after ✅ 
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-17T17:59:56Z
user: login: rayane-d
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-29T09:57:00Z

Review comments:
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: shubham1206agra
body: ```suggestion
                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
```

This was causing bug when trying to pick images from gallery.
created_at: 2025-04-12T17:04:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: war-in
body: Could you elaborate on this? I checked it and it's working fine now
created_at: 2025-04-14T11:04:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: shubham1206agra
body: If you try to pick a avatar from gallery in Android, this change caused file to appear as invalid.
created_at: 2025-04-14T11:18:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: war-in
body: Are you able to verify this? I don't have my physical device at the moment
created_at: 2025-04-14T11:24:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: shubham1206agra
body: Yes
created_at: 2025-04-14T14:56:03Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: war-in
body: > If you try to pick a avatar from gallery in Android, this change caused file to appear as invalid.

If it's android -> I checked it and it's working fine
created_at: 2025-04-14T15:14:10Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: shubham1206agra
body: @war-in It's not working for me.
created_at: 2025-04-14T15:24:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: shubham1206agra
body: 
https://github.com/user-attachments/assets/85cbbe59-786d-491e-9200-5368e8eae78d

@war-in See the video.
created_at: 2025-04-14T15:29:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: war-in
body: Ok, so the steps are

1. Go to settings
2. Open Profile and tap avatar
3. then choose avatar from gallery

I followed those steps with the local build and the profile photo (avatar) was changed

Maybe we need another ad-hoc build?
created_at: 2025-04-14T15:29:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: shubham1206agra
body: @war-in Is there a problem in making this change?
created_at: 2025-04-14T15:33:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: war-in
body: No, it's not
Just thought it's not necessary anymore

I'll try to reproduce it on my end and fix the issue 👍 
created_at: 2025-04-14T15:44:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -330,8 +327,8 @@ function AttachmentPicker({
                 }
 
                 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-                const fileDataName = ('fileName' in fileData && fileData.fileName) || ('name' in fileData && fileData.name) || '';
-                const fileDataUri = ('fileCopyUri' in fileData && fileData.fileCopyUri) || ('uri' in fileData && fileData.uri) || '';
+                const fileDataName = ('name' in fileData && fileData.name) || '';
path: src/components/AttachmentPicker/index.native.tsx
user: login: war-in
body: @shubham1206agra thank you for suggestion
I applied it in https://github.com/Expensify/App/pull/59363/commits/7affcb2aee8294d89f8125d48cac768da96b4da2
created_at: 2025-04-15T11:22:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -100,6 +100,7 @@
     "@react-native-clipboard/clipboard": "^1.15.0",
     "@react-native-community/geolocation": "3.3.0",
     "@react-native-community/netinfo": "11.2.1",
+    "@react-native-documents/picker": "^10.1.1",
path: package.json
user: login: rayane-d
body: Upgrading `@react-native-documents/picker` to `10.1.1` caused this bug: https://github.com/Expensify/App/issues/60600
created_at: 2025-05-29T09:57:00Z
author_association: CONTRIBUTOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-03-31T14:12:38Z
body: :warning: This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. :warning:
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-31T14:35:10Z
body: :warning: This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. :warning:
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-31T14:48:49Z
body: :warning: This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. :warning:
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-31T15:32:02Z
body: :warning: This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. :warning:
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-07T11:15:46Z
body: :warning: This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. :warning:
author_association: CONTRIBUTOR
user: login: melvin-bot[bot]
created_at: 2025-04-11T09:33:58Z
body: @andrewgable Please copy/paste the Reviewer Checklist from [here](https://raw.githubusercontent.com/Expensify/App/main/contributingGuides/REVIEWER_CHECKLIST.md) into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-04-11T12:35:09Z
body: 🚧 @mountiny has triggered a test app build. You can view the [workflow run here](https://github.com/Expensify/App/actions/runs/14403245934).
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-11T13:16:28Z
body: :test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
| Android :robot:  | iOS :apple: |
| ------------- | ------------- |
| Android :robot::arrows_counterclockwise:  | iOS :apple::arrows_counterclockwise: |
| https://ad-hoc-expensify-cash.s3.amazonaws.com/android/59363-hybrid/index.html  | https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/59363-hybrid/index.html  |
| ![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/android/59363-hybrid/index.html)  | ![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/59363-hybrid/index.html)  |
| Desktop :computer: | Web :spider_web: |
| https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg  | https://59363.pr-testing.expensify.com  |
| ![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg)  | ![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://59363.pr-testing.expensify.com)  |

---

:eyes: [View the workflow run that generated this build](https://github.com/Expensify/App/actions/runs/14403245934) :eyes:

author_association: CONTRIBUTOR
user: login: shubham1206agra
created_at: 2025-04-12T16:41:23Z
body: @mountiny This can't be tested on Hybrid iOS App on simulator.
author_association: CONTRIBUTOR
user: login: shubham1206agra
created_at: 2025-04-12T17:10:02Z
body: <img width="482" alt="Screenshot 2025-04-12 at 10 39 21 PM" src="https://github.com/user-attachments/assets/5a74c835-75d3-46ac-bf05-ed8fd1e89011" />

@war-in When picking the PDF file, this error appears.
author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-14T11:04:52Z
body: > When picking the PDF file, this error appears.

@shubham1206agra thank you! I'm going to debug it now
author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-14T13:56:34Z
body: @shubham1206agra attaching pdf is fixed now, thank you!
author_association: CONTRIBUTOR
user: login: shubham1206agra
created_at: 2025-04-14T14:56:19Z
body: ## Reviewer Checklist

- [x] I have verified the author checklist is complete (all boxes are checked off).
- [x] I verified the correct issue is linked in the `### Fixed Issues` section above
- [x] I verified testing steps are clear and they cover the changes made in this PR
    - [x] I verified the steps for local testing are in the `Tests` section
    - [x] I verified the steps for Staging and/or Production testing are in the `QA steps` section
    - [x] I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- [x] I checked that screenshots or videos are included for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I verified tests pass on **all platforms** & I tested again on:
    - [x] Android: Native
    - [x] Android: mWeb Chrome
    - [x] iOS: Native
    - [x] iOS: mWeb Safari
    - [x] MacOS: Chrome / Safari
    - [x] MacOS: Desktop
- [x] If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- [x] I verified proper code patterns were followed (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`).
    - [x] I verified that comments were added to code that is not self explanatory
    - [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    - [x] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60)
    - [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60-L68)
    - [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    - [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [x] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I verified that this PR follows the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` have been tested & I retested again)
- [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [x] If a new component is created I verified that:
    - [x] A similar component doesn't exist in the codebase
    - [x] All props are defined accurately and each prop has a `/** comment above it */`
    - [x] The file is named correctly
    - [x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    - [x] The only data being stored in the state is data necessary for rendering and nothing else
    - [x] For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor)
    - [x] Any internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`)
    - [x] All JSX used for rendering exists in the render method
    - [x] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- [x] If any new file was added I verified that:
    - [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [x] If a new CSS style is added I verified that:
    - [x] A similar style doesn't already exist
    - [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG`)
- [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    - [x] I verified that all the inputs inside a form are aligned with each other.
    - [x] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [x] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [x] For any bug fix or new feature in this PR, I verified that sufficient [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) are included to prevent regressions in this flow.
- [x] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.
- [x] I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

### Screenshots/Videos

https://github.com/user-attachments/assets/921e42e1-ff5b-4e9a-85a8-da35a6406d2b

author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-15T11:22:28Z
body: @shubham1206agra All comments addressed! Thank you for review
author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-15T11:38:45Z
body: There was a revert of [PR](https://github.com/Expensify/App/pull/59330) touching HEIC file logic. We touch the same area so we'll probably introduce the same issue 
author_association: CONTRIBUTOR
user: login: shubham1206agra
created_at: 2025-04-15T14:44:33Z
body: @war-in What are the next steps here?
author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-15T14:47:13Z
body: @shubham1206agra we should wait for the mentioned PR to be reintroduced or maybe ask @mountiny to trigger builds and check if this PR has the same problem
@mountiny could you run it? 🙏 
author_association: CONTRIBUTOR
user: login: shubham1206agra
created_at: 2025-04-15T14:48:44Z
body: @mountiny is OOO sick right now.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-15T15:20:27Z
body: 🚧 @AndrewGable has triggered a test app build. You can view the [workflow run here](https://github.com/Expensify/App/actions/runs/14473164889).
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-15T15:59:53Z
body: :test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
| Android :robot:  | iOS :apple: |
| ------------- | ------------- |
| Android :robot::arrows_counterclockwise:  | iOS :apple::arrows_counterclockwise: |
| https://ad-hoc-expensify-cash.s3.amazonaws.com/android/59363-hybrid/index.html  | https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/59363-hybrid/index.html  |
| ![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/android/59363-hybrid/index.html)  | ![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/59363-hybrid/index.html)  |
| Desktop :computer: | Web :spider_web: |
| https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg  | https://59363.pr-testing.expensify.com  |
| ![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg)  | ![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://59363.pr-testing.expensify.com)  |

---

:eyes: [View the workflow run that generated this build](https://github.com/Expensify/App/actions/runs/14473164889) :eyes:

author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-15T16:43:03Z
body: @shubham1206agra I tested on my iOS device and there is no error on this PR but asked Vit for a retest
Feel free to re-review or approve 🙏 
author_association: CONTRIBUTOR
user: login: mountiny
created_at: 2025-04-15T19:05:26Z
body: Will test later thanks
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-15T19:06:20Z
body: 🚧 @mountiny has triggered a test app build. You can view the [workflow run here](https://github.com/Expensify/App/actions/runs/14477393726).
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-15T19:48:17Z
body: :test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
| Android :robot:  | iOS :apple: |
| ------------- | ------------- |
| Android :robot::arrows_counterclockwise:  | iOS :apple::arrows_counterclockwise: |
| https://ad-hoc-expensify-cash.s3.amazonaws.com/android/59363-hybrid/index.html  | https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/59363-hybrid/index.html  |
| ![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/android/59363-hybrid/index.html)  | ![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/59363-hybrid/index.html)  |
| Desktop :computer: | Web :spider_web: |
| https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg  | https://59363.pr-testing.expensify.com  |
| ![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg)  | ![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=https://59363.pr-testing.expensify.com)  |

---

:eyes: [View the workflow run that generated this build](https://github.com/Expensify/App/actions/runs/14477393726) :eyes:

author_association: CONTRIBUTOR
user: login: roryabraham
created_at: 2025-04-15T20:50:06Z
body: Retesting the issue in question: https://expensify.slack.com/archives/C049HHMV9SM/p1744647887778349
author_association: CONTRIBUTOR
user: login: roryabraham
created_at: 2025-04-15T20:56:15Z
body: yeah, so on the latest staging TestFlight version, I can upload an heic and view it just fine. But on this AdHoc build I could upload it fine but then not view it afterwards. So I think this PR would cause a regression unless that's fixed
author_association: CONTRIBUTOR
user: login: mountiny
created_at: 2025-04-15T22:27:04Z
body: It worked
author_association: CONTRIBUTOR
user: login: mountiny
created_at: 2025-04-15T22:27:39Z
body: I mean uploading heic photo from the gallery on iPhone
author_association: CONTRIBUTOR
user: login: roryabraham
created_at: 2025-04-16T00:29:38Z
body: Well I was able to upload the photo (and even view it on other devices), but on the AdHoc build I couldn't view it on the device in which it was uploaded. The preview showed, but after upload it was not rendering at all.

Not sure if that will be reproducible for others as well
author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-16T08:23:22Z
body: @roryabraham yeah, facing the same issue, but!
I check on another [ad-hoc build](https://github.com/Expensify/App/pull/60304#issuecomment-2807020484) and it also has the same issue (doesn't touch AttachmentPicker)

The bug might be caused by the new reports project, which is currently behind beta (and we all have access to it). I logged into my regular gmail account and the flow works fine so the problem seems unrelated :)
author_association: CONTRIBUTOR
user: login: Kicu
created_at: 2025-04-16T09:25:15Z
body: If its related to `canUseTableReport` BETA then the clicking on preview can be tracked in this issue: https://github.com/Expensify/App/issues/57509

author_association: CONTRIBUTOR
user: login: mountiny
created_at: 2025-04-17T10:31:40Z
body: @war-in Cna you please update the test/ QA steps to include the ios flow scanning a receipt for expense and choosing an heic image from gallery? 

@shubham1206agra Can you please complete the review/ approve if all works well for you? thanks!
author_association: CONTRIBUTOR
user: login: war-in
created_at: 2025-04-17T12:45:52Z
body: @mountiny steps updated
author_association: CONTRIBUTOR
user: login: mountiny
created_at: 2025-04-17T17:34:23Z
body: @shubham1206agra were you able to reproduce the issue Rory mentioned? 
author_association: CONTRIBUTOR
user: login: shubham1206agra
created_at: 2025-04-17T17:36:09Z
body: @allgandalf tested this here https://expensify.slack.com/archives/C02NK2DQWUX/p1744895681338739?thread_ts=1744893413.115159&cid=C02NK2DQWUX and he did not encountered this issue.
author_association: CONTRIBUTOR
user: login: mountiny
created_at: 2025-04-21T21:19:36Z
body: I think we are ready to go and test this out so going to merge this and the OldApp PR
author_association: CONTRIBUTOR
user: login: OSBotify
created_at: 2025-04-21T21:29:53Z
body: :hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-21T23:40:43Z
body: 🚀 [Deployed](https://github.com/Expensify/App/actions/runs/14583009453) to staging by https://github.com/mountiny in version: 9.1.31-0 🚀

platform | result
---|---
🖥 desktop 🖥|success ✅
🕸 web 🕸|success ✅
🤖 android 🤖|success ✅
🍎 iOS 🍎|success ✅
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-23T18:17:14Z
body: 🚀 [Deployed](https://github.com/Expensify/App/actions/runs/14624867920) to production by https://github.com/AndrewGable in version: 9.1.31-3 🚀

platform | result
---|---
🖥 desktop 🖥|success ✅
🕸 web 🕸|success ✅
🤖 android 🤖|failure ❌
🍎 iOS 🍎|success ✅
author_association: CONTRIBUTOR