Skip to content

[Pre RN 0.79] Migrate documents picker #59363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

war-in
Copy link
Contributor

@war-in war-in commented Mar 31, 2025

Explanation of Change

I'm working on RN 0.78 support #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

$ #57511
PROPOSAL:
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13510

Tests

  1. Open app and verify it runs correctly

  2. Go to chat and send attachment

  3. Verify that the flow is correct

  4. In ios native, select Create Expense

  5. Scan and choose image taken on the iphone in gallery (so its the ios heic format)

  6. Note you have to choose the image from gallery, taking the picture in the app works fine

  7. Create this expense

  8. Verify it works

Offline tests

QA Steps

  1. Open app and verify it runs correctly

  2. Go to chat and send attachment

  3. Verify that the flow is correct

  4. In ios native, select Create Expense

  5. Scan and choose image taken on the iphone in gallery (so its the ios heic format)

  6. Note you have to choose the image from gallery, taking the picture in the app works fine

  7. Create this expense

  8. Verify it works

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • 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)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • 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)
  • I followed proper code patterns (see Reviewing the code)
    • 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)
    • I verified that comments were added to code that is not self explanatory
    • 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.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used 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:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • 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.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • 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
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • 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
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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.
  • 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)
  • 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.
  • 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.
  • 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:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • 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.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • 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

Android: Native
Screen.Recording.Apr.11.2025.from.Marcin.Warchol.mp4
Android: mWeb Chrome
iOS: Native
O.Rany.Messenger.Video.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

Copy link
Contributor

⚠️ 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. ⚠️

This comment was marked as duplicate.

This comment was marked as duplicate.

This comment was marked as duplicate.

# Conflicts:
#	src/components/AttachmentPicker/index.native.tsx

This comment was marked as duplicate.

# Conflicts:
#	src/components/AttachmentPicker/index.native.tsx
@war-in war-in marked this pull request as ready for review April 11, 2025 09:33
@war-in war-in requested a review from a team as a code owner April 11, 2025 09:33
@melvin-bot melvin-bot bot requested review from AndrewGable and removed request for a team April 11, 2025 09:33
Copy link

melvin-bot bot commented Apr 11, 2025

@AndrewGable Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Copy link
Contributor

🚧 @mountiny has triggered a test app build. You can view the workflow run here.

This comment has been minimized.

@shubham1206agra
Copy link
Contributor

@mountiny This can't be tested on Hybrid iOS App on simulator.

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Apr 12, 2025

Screenshot 2025-04-12 at 10 39 21 PM

@war-in When picking the PDF file, this error appears.

@war-in
Copy link
Contributor Author

war-in commented Apr 15, 2025

@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 🙏

@mountiny
Copy link
Contributor

Will test later thanks

Copy link
Contributor

🚧 @mountiny has triggered a test app build. You can view the workflow run here.

Copy link
Contributor

🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪

Android 🤖 iOS 🍎
Android 🤖🔄 iOS 🍎🔄
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 iOS
Desktop 💻 Web 🕸️
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/59363/NewExpensify.dmg https://59363.pr-testing.expensify.com
Desktop Web

👀 View the workflow run that generated this build 👀

@roryabraham
Copy link
Contributor

Retesting the issue in question: https://expensify.slack.com/archives/C049HHMV9SM/p1744647887778349

@roryabraham
Copy link
Contributor

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

@mountiny
Copy link
Contributor

It worked

@mountiny
Copy link
Contributor

I mean uploading heic photo from the gallery on iPhone

@roryabraham
Copy link
Contributor

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

@war-in
Copy link
Contributor Author

war-in commented Apr 16, 2025

@roryabraham yeah, facing the same issue, but!
I check on another ad-hoc build 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 :)

@Kicu
Copy link
Member

Kicu commented Apr 16, 2025

If its related to canUseTableReport BETA then the clicking on preview can be tracked in this issue: #57509

@mountiny
Copy link
Contributor

@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!

@war-in
Copy link
Contributor Author

war-in commented Apr 17, 2025

@mountiny steps updated

@mountiny
Copy link
Contributor

@shubham1206agra were you able to reproduce the issue Rory mentioned?

@shubham1206agra
Copy link
Contributor

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ✅

@mountiny mountiny changed the title [Pre RN 0.78] Migrate documents picker [Pre RN 0.79] Migrate documents picker Apr 19, 2025
@mountiny
Copy link
Contributor

I think we are ready to go and test this out so going to merge this and the OldApp PR

@mountiny mountiny merged commit 51b335a into Expensify:main Apr 21, 2025
25 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.31-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Copy link
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 9.1.31-3 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

@@ -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",
Copy link
Contributor

@rayane-d rayane-d May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading @react-native-documents/picker to 10.1.1 caused this bug: #60600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants