fix: prevent iOS crash when sharing images via AttachmentPreview#80791
fix: prevent iOS crash when sharing images via AttachmentPreview#80791roryabraham merged 1 commit intomainfrom
Conversation
|
@shubham1206agra 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] |
Move file type checks (isVideo, isFileImage) above video hooks and conditionally pass source to useVideoPlayer only for video files. This prevents expo-video from attempting to process non-video sources which was causing iOS crashes when sharing images.
cf077e8 to
5817bfb
Compare
|
🚧 @marcochavezf has triggered a test Expensify/App build. You can view the workflow run here. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-01-28.22.27.08.movAndroid: mWeb Chrome2026-01-28.22.13.10.moviOS: HybridApp2026-01-28.22.27.08.moviOS: mWeb Safari2026-01-28.22.13.10.movMacOS: Chrome / Safari2026-01-28.22.10.05.mov |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
LGTM! |
|
And the builds issue is known |
|
Confirmed that the remote iOS build failures are unrelated. |
|
@roryabraham looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
…hare-crash-v2 fix: prevent iOS crash when sharing images via AttachmentPreview (cherry picked from commit daa914f) (cherry-picked to staging by roryabraham)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.3.10-6 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.10-6 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.3.11-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|
Explanation of Change
The iOS app was crashing when users tried to share an image from their device's media library. The root cause was that
useVideoPlayer(source)was being called unconditionally for all attachment sources (including images) inAttachmentPreview.tsx. When expo-video attempted to process a non-video file (like an image), it caused a crash on iOS.This fix:
isVideo,isFileImage) above the video hooksuseVideoPlayeronly when it's actually a video file:useVideoPlayer(isVideo ? source : null)isVideovariable in the conditional render instead of duplicating the checkFixed Issues
$ #80710
PROPOSAL: #80710 (comment)
Tests
Offline tests
N/A - This fix is for the iOS Share Extension which requires network connectivity to function.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A - iOS-specific Share Extension fix
Android: mWeb Chrome
N/A - iOS-specific Share Extension fix
iOS: Native
See video confirmation from @blazejkustra in issue: #80710 (comment)
iOS: mWeb Safari
N/A - iOS-specific Share Extension fix
MacOS: Chrome / Safari
N/A - iOS-specific Share Extension fix