-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Update picker to avoid showing svg images on android #27834
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of writing the new feature as a patch (androidAllowedMimeTypes). We should just directly patch the native code i.e. just call libraryIntent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypesHere);
The tests steps are not correct, we should specify that svg images should not be pickable (not shown in the picker) |
Updated the steps to include that.
@s77rt - Sure, would you prefer it to be toggleable via a boolean like |
It should be done unconditionally, there won't be any cases where we'd want this to be controllable |
@s77rt Updated the PR - Please take a look, Thanks! |
+ // Generated by merging from lists of image mimetypes supported on Android, and list of IANA media-types: | ||
+ // https://android.googlesource.com/platform/external/mime-support/+/main/mime.types#636 | ||
+ // https://www.iana.org/assignments/media-types/media-types.xhtml#image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use the Android one to be sure we are not adding something that was not added before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the android list is not really exhaustive list (this was the limited info I was able to find), because it doesn't contain image formats like avif & heif (default for camera app on some new android phones). Also previously it was image/*
which I believe covers all the formats. We should instead worry about missing any format, which I believe shouldn't be the case as any widespread new format should probably be registered by IANA and we are using their list here.
Please update the test steps: Tests (Android Only)
|
@s77rt - updated the steps! |
Reviewer Checklist
Screenshots/VideosWebMobile Web - ChromeMobile Web - SafariDesktopiOS |
+ // Avoid image picker to show svg images on Android, to get the behaviour to be same as on iOS. | ||
+ // Since, we can't exclude an image format, we instead allowlist all the possible image formats, | ||
+ // excluding the 'image/svg+xml' mime type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments clarification:
Prevent svg images from being selected as they are not supported (Image component does not support them) and also because iOS does not allow them to be selected (for consistency).
Since, we can't exclude a mime type, we instead allow all image mime types except 'image/svg+xml'. Image mime types are generated by merging the Android image mime type support and the IANA media-types lists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/Julesssss in version: 1.3.73-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.73-1 🚀
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 1.3.74-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
Heads up, we should not be adding any new patches without also creating an upstream PR with the same change. |
Reminder: I need to raise an upstream PR |
Asked a clarifying question here. |
We didn't raise an upstream PR because there was already a similar open PR react-native-image-picker/react-native-image-picker#2145 and it was not moving forward. Will look into this asap |
Details
Upstream PR for patch
react-native-image-picker/react-native-image-picker#2145
Fixed Issues
$ #26768
PROPOSAL: #26768 (comment)
Tests (Android Only)
Offline tests (Android only)
QA Steps (Android only)
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.mp4
Mobile Web - Chrome
android-chrome.mp4
Mobile Web - Safari
ios-safari.mp4
Desktop
desktop.mp4
iOS
ios-native.mp4
Android
android-native.mp4