react-native-image-crop-picker icon indicating copy to clipboard operation
react-native-image-crop-picker copied to clipboard

Edit selected photos with limited photo library in IOS 14

Open eduluq opened this issue 3 years ago • 14 comments

Version

  • react-native-image-crop-picker v0.35.2
  • react-native v0.63.4

Platform

  • iOS14

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

eduluq avatar Apr 08 '21 11:04 eduluq

I experienced the same issue

rukmanary avatar Apr 08 '21 13:04 rukmanary

+1

jpmazza avatar Apr 09 '21 20:04 jpmazza

+1

longb1997 avatar Apr 16 '21 02:04 longb1997

+1

Hamawis avatar Apr 26 '21 08:04 Hamawis

I am also experiencing the same issue.

malikmani avatar Apr 29 '21 07:04 malikmani

I experienced the same issue

mohamed2m2018 avatar Jun 07 '21 08:06 mohamed2m2018

Please fix this. This library is otherwise unusable for ios

MCervenka avatar Jun 21 '21 11:06 MCervenka

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 avatar Jun 21 '21 12:06 MCervenka

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?

mohamed2m2018 avatar Jun 21 '21 12:06 mohamed2m2018

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 avatar Jun 21 '21 13:06 MCervenka

@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.

MCervenka avatar Jun 22 '21 12:06 MCervenka

has anybody found any other workaround for this???

sjonchhe avatar Aug 17 '21 12:08 sjonchhe

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.

zholmes1 avatar Oct 11 '21 12:10 zholmes1

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.

luizppa avatar May 31 '22 15:05 luizppa