ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.08k stars 1.55k forks source link

Edit selected photos with limited photo library in IOS 14 #1569

Open eduluq opened 3 years ago

eduluq commented 3 years ago

Version

Platform

Actual Behavior

When I first install my app and try to upload an image, I select "Allow access just to the selected pictures" and pick just one photo. Then if i try to upload another photo i'm not asked again about selecting new ones so my only choices are the previous selections (in this case just that 1 photo).

To add more images to my selection I only can navigate to Settings > Privacy > Photos > App to get the option for "Edit Selected Photos".

Expected Behavior

Is there any way I can Edit that selection inside my app or prompt permissions again to have a better UX for my users?

Thank you!

Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate

rukmanary commented 3 years ago

I experienced the same issue

jpmazza commented 3 years ago

+1

longb1997 commented 3 years ago

+1

Hamawis commented 3 years ago

+1

malikmani commented 3 years ago

I am also experiencing the same issue.

mohamed2m2018 commented 3 years ago

I experienced the same issue

MCervenka commented 3 years ago

Please fix this. This library is otherwise unusable for ios

MCervenka commented 3 years ago

I have found that we can retriger image selection with following:

import {openLimitedPhotoLibraryPicker} from 'react-native-permissions';

openLimitedPhotoLibraryPicker().catch(() => {
  console.warn('Cannot open photo library picker');
});
mohamed2m2018 commented 3 years ago

I have found that we can retriger image selection with following:

import {openLimitedPhotoLibraryPicker} from 'react-native-permissions';

openLimitedPhotoLibraryPicker().catch(() => {
  console.warn('Cannot open photo library picker');
});

@MCervenka but how can you get the response in a callback?

MCervenka commented 3 years ago

The permissions needs to open after Picker - so I added timeout:

if (Platform.OS === 'ios' && cameraOncedOpened) {
        try {
          setTimeout(openLimitedPhotoLibraryPicker, 300);
        } catch (e) {
          console.log('openLimitedPhotoLibraryPicker', e);
        }
      }
      cameraOncedOpened = true;

      const result = await ImagePicker.openPicker(options);
MCervenka commented 3 years ago

@mohamed2m2018 then the flow is the same as when you first open the picker after opening the phone. After you click done in selection, it would close and behind it is the ImagePicker - which have updated selection.

sjonchhe commented 3 years ago

has anybody found any other workaround for this???

zholmes1 commented 2 years ago

I do think this is a pretty serious issue with this package. An iOS 14 user will only be able to allow more photos the first time the image picker is open. Every time after that they will be stuck with the images they previously allowed. I like the solution from @MCervenka but I feel like it may be confusing for some users. Here's a similar approach I came up with:

if (Platform.OS === 'ios' && hasOpened) {
  return Alert.alert(
    'Some alert title',
    'Some alert description',
    [
      {
        text: 'Cancel'
      },
      {
        text: 'Allow More',
        onPress: () => {
          MediaLibrary.presentPermissionsPickerAsync()
        }
      },
      {
        text: 'Import,
        onPress: doImport
      }
    ]
  )
} else doImport()

Where doImport() calls ImageCropPicker.openPicker and also sets hasOpened to true.

luizppa commented 2 years ago

Has this been fixed yet? I have not found any sort of callback to when the limited selection changes, I also believe this is a serious problem (but maybe it should be fixed in react-native-permissions instead?).

has anybody found any other workaround for this???

In the meantime, we found a workaround for this by navigating the user to another screen to manage the app permissions and having him navigate back when he is done, this way we can use useFocusEffect to update the shown photos.