Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

renchap
Copy link
Contributor

@renchap renchap commented Jun 16, 2023

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.

example/src/components/DemoResponse.tsx Show resolved Hide resolved
src/platforms/native.ts Outdated Show resolved Hide resolved
@renchap renchap force-pushed the restrict-mime-types branch from ac28ad4 to 753a0f4 Compare June 16, 2023 16:00
@renchap
Copy link
Contributor Author

renchap commented Sep 8, 2023

@Johan-dutoit Could you have a look at this PR?

It has been running in our production app for 2 months without issues.

@Julesssss
Copy link

@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

@renchap renchap force-pushed the restrict-mime-types branch from 753a0f4 to 55149ba Compare May 7, 2024 21:50
@renchap renchap force-pushed the restrict-mime-types branch from 55149ba to a6197d7 Compare October 23, 2024 10:19
@renchap renchap force-pushed the restrict-mime-types branch from a6197d7 to 705e451 Compare February 25, 2025 17:23
@renchap
Copy link
Contributor Author

renchap commented Feb 25, 2025

Rebased the PR against main, and tested that it works fine on a Pixel 5 phone.

@renchap renchap force-pushed the restrict-mime-types branch from 705e451 to c23ef03 Compare February 27, 2025 08:37
@Johan-dutoit Johan-dutoit merged commit 2986838 into react-native-image-picker:main Feb 27, 2025
1 check passed
Johan-dutoit pushed a commit that referenced this pull request Feb 27, 2025
# [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))
@Johan-dutoit
Copy link
Collaborator

🎉 This PR is included in version 8.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Cactueonicle added a commit to Cactueonicle/improvements that referenced this pull request Aug 13, 2025
TideTrackerDev added a commit to TideTrackerDev/convexification that referenced this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.