-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(android): permit to specify a list of allowed mime-types #2145
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
feat(android): permit to specify a list of allowed mime-types #2145
Conversation
android/src/main/java/com/imagepicker/ImagePickerModuleImpl.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/imagepicker/ImagePickerModuleImpl.java
Outdated
Show resolved
Hide resolved
ac28ad4
to
753a0f4
Compare
@Johan-dutoit Could you have a look at this PR? It has been running in our production app for 2 months without issues. |
Bumping this comment |
753a0f4
to
55149ba
Compare
55149ba
to
a6197d7
Compare
a6197d7
to
705e451
Compare
Rebased the PR against |
705e451
to
c23ef03
Compare
# [8.2.0](v8.1.0...v8.2.0) (2025-02-27) ### Features * **android:** permit to specify a list of allowed mime-types ([#2145](#2145)) ([2986838](2986838))
🎉 This PR is included in version 8.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [8.2.0](react-native-image-picker/react-native-image-picker@v8.1.0...v8.2.0) (2025-02-27) ### Features * **android:** permit to specify a list of allowed mime-types ([#2145](react-native-image-picker/react-native-image-picker#2145)) ([2986838](react-native-image-picker/react-native-image-picker@2986838))
# [8.2.0](react-native-image-picker/react-native-image-picker@v8.1.0...v8.2.0) (2025-02-27) ### Features * **android:** permit to specify a list of allowed mime-types ([#2145](react-native-image-picker/react-native-image-picker#2145)) ([2986838](react-native-image-picker/react-native-image-picker@2986838))
Motivation (required)
The Android camera app has an option to store both JPEG and RAW (DNG format) files for each picture. When this option is enabled, both versions of the image are shown to the user (but without any indication of the file format, so the users sees every image twice).
This new options allows you to restrict the allowed MIME types, for example
restrictMimeTypes: ['image/jpeg', 'image/heic', 'image/png']
.On Android 13 (new Photo Picker), only the matching files are displayed, no more duplicates.
On older Android versions, every file is still displayed in the file explorer, but non-matching files are grayed and can not be selected.
This option can not be implemented on iOS, as the API only allows you to filter on predefined types (images, videos, slow-mos…).
Test Plan (required)
I used
restrictMimeTypes: ['image/jpeg', 'image/heic', 'image/png']
with the example app and tested the behaviour with and without the option on an Android 10 and Android 13 devices.