ivpusic / react-native-image-crop-picker

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

App restart after accessing Photo/Gallery folder #1509

Open apgsn opened 3 years ago

apgsn commented 3 years ago

Version

Platform

Android

Expected behaviour

Select multiple pictures from folder and process them

Actual behaviour

As soon as I click "Done" after selecting some images from "Images" or "Gallery" folder, the app restarts and the images are not uploaded. On the other hand, the upload from other sources (such as recent images, Dropbox, or Google Drive) works as intended.

Steps to reproduce

  1. from the drawer menu (or top menu) select "Photo" or "Gallery" folder
  2. select any picture and press "Done"

Code:

  const images = await ImagePicker.openPicker({
    multiple: true,
    forceJpg: true,
    mediaType: 'photo',
  });
Schermata 2021-01-11 alle 12 56 18

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

apgsn commented 3 years ago

Update: apparently you don't even need to select a picture.

  1. from the drawer menu (or top menu) select "Photo" or "Gallery" folder
  2. exit picker by simply going back
  3. the app goes blank and restarts

I also discovered I cannot reproduce it on simulator, only physical devices. Not really sure what the deal is, any help is appreciated.

sniperosx commented 3 years ago

Hello @apgsn, many of our app users are reporting the exact same behaviour. Sadly we couldn't get it replicated on our test devices yet. I'm eager to get some more infos about that problem :)

RenovJ commented 3 years ago

Same here. Selecting item/items on Recent items is available. on Gallery is not. This is happening only on Android.

RenovJ commented 3 years ago

Added android:requestLegacyExternalStorage="true" on AndroidManifest.xml. It is working now

mernxl commented 3 years ago

Added android:requestLegacyExternalStorage="true" on AndroidManifest.xml. It is working now

Thanks @RenovJ, your response fixes my case where the gallery opens but the image isn't selected, and the Camera doesn't not open atall.

mrsasuu commented 3 years ago

ndroid:requestLegacyExternalStorage="true"

https://developer.android.com/training/data-storage/use-cases: Temporarily opt-out of scoped storage Before your app is fully compatible with scoped storage, you can temporarily opt out by using one of the following methods:

Target Android 9 (API level 28) or lower. If you target Android 10 (API level 29) or higher, set the value of requestLegacyExternalStorage to true in your app's manifest file:

<manifest ... >

<application android:requestLegacyExternalStorage="true" ... > ... Caution: After you update your app to target Android 11 (API level 30), the system ignores the requestLegacyExternalStorage attribute when your app is running on Android 11 devices, so your app must be ready to support scoped storage and to migrate app data for users on those devices. To test how an app targeting Android 9 or lower behaves when using scoped storage, you can opt in to the behavior by setting the value of requestLegacyExternalStorage to false. If you are testing on an Android 11 device, you can also use app compatibility flags to test your app's behavior with or without scoped storage.

It seems not to be a "solution" for newer android versions

chhavi-khandelwal commented 3 years ago

I am facing the same issue. Here are few findings:

  1. Device is - Honor 5C NEM-L51; android version: 7.0
  2. After selecting the image from gallery, the image editor to crop/rotate is not shown and app refreshes. Most importantly, when I again try to upload the same image, it works. So, according to findings, (to me) this has been happening when an image is tried to upload for the first time. The second time it works.
kyleclegg commented 3 years ago

+1 to addressing this as soon as possible. As another piece of information, this seems to occur on devices with high megapixel cameras like the Huawei tablet.