react-native-image-picker / react-native-image-picker

:sunrise_over_mountains: A React Native module that allows you to use native UI to select media from the device library or directly from the camera.
MIT License
8.42k stars 2.07k forks source link

[🐛] selectionLimit does not work on Android (not tested on iOS) #2103

Open bekatd opened 1 year ago

bekatd commented 1 year ago

Description

I need to limit the number of maximum files user can select

How to repeat issue and example

I set the selectionLimit prop to 5, but user is allowed to select more images

const openImagePicker = () => {
  launchImageLibrary(
    { mediaType: 'photo', selectionLimit: 5 },
    ({ assets }) => {
      setImages(
        assets.map(({ uri, fileName: name, type }) => ({ uri, name, type }))
      );
    }
  );
};

Solution

Image picker should respect provided value of selectionLimit and prevent user from selecting more than allowed number of images

Additional Information

renchap commented 1 year ago

This option is only supported in the new Android PhotoPicker (Android 13+).

Meetcpatel commented 5 months ago

Facing the same