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

"Invalid image selected" for images captured by Huawei device.

Open yixuan98 opened this issue 4 years ago • 16 comments

Description

Selecting images captured by Huawei devices (mainly P30 and P30 Pro) resulted in error "Invalid image selected". There is no error on other android devices/images that are on Huawei devices but captured by other phone. Suspect bug is on image information returned by Huawei devices.

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.32.2
  • react-native v0.62.2

Platform

Tell us to which platform this issue is related

  • Android 10
  • Huawei P30 & Huawei P30 Pro

Expected behaviour

  1. Open gallery
  2. Select one or more image(s)
  3. Image details returned properly

Actual behaviour

  1. Open gallery
  2. Select one or more image(s)
  3. Promise rejected with error "Invalid image selected"

Steps to reproduce (Huawei P30 series)

  1. Open picker -> navigate to gallery
  2. Select one or more image(s) that are captured with the phone itself
  3. Confirm selection
  4. Promise rejected with error "Invalid image selected"

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

yixuan98 avatar Aug 23 '20 06:08 yixuan98

Same issue on Nexus S that is also running Android 10.0

SocialAnxty avatar Aug 23 '20 19:08 SocialAnxty

Same issue here

  • react-native-image-crop-picker v0.32.2

  • react-native v0.63.2

Huawei Mate 30

-Update: A temporary solution - adding: android:requestLegacyExternalStorage="true"

Kobidl avatar Aug 24 '20 14:08 Kobidl

Same issue Redmi K30 Ultra react-native-image-crop-picker v0.35.0 react-native v0.63.2

zhengyangkang avatar Sep 18 '20 08:09 zhengyangkang

Same issue here on Android 10:

"react-native-image-crop-picker": "^0.33.2", "react-native": "0.61.5",

gustavograupner avatar Sep 25 '20 22:09 gustavograupner

Same issue here

"react-native-image-crop-picker": "^0.35.0", "react-native": "0.63.2",

Karthik-B-06 avatar Sep 29 '20 12:09 Karthik-B-06

Same, Motorola G7 Play

jacquesdev avatar Oct 19 '20 13:10 jacquesdev

Same issue here

  • Android 10, OnePlus 6
  • "react-native-image-crop-picker": "0.34.0",
  • "react-native": "0.62.0",

The issue only happens when I select the file from the phone gallery, all the other categories are fine (see screenshots). I tested with the exact same image multiple times: when going through any of the choices in the menu the image is selected, but when going into the phone gallery it's not.

Could it be a path or access rights issue?

The menu: Screenshot_20201028-104559__01

SkipCat avatar Oct 28 '20 10:10 SkipCat

If it's a permissions issue, could this suggestion fix it https://github.com/ivpusic/react-native-image-crop-picker/issues/1419#issuecomment-702652168?

jacquesdev avatar Oct 28 '20 11:10 jacquesdev

I think there would be no reason to add write permission if we just want to open picker not camera or something else.

matinzd avatar Nov 11 '20 23:11 matinzd

In AndroidManifest.xml

uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE < application android:requestLegacyExternalStorage="true" ...

In your project -> check de permissions

import { PermissionsAndroid, Platform } from "react-native"; import ImagePicker from 'react-native-image-crop-picker';

async function hasAndroidPermission() { const permission = PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE;

const hasPermission = await PermissionsAndroid.check(permission); if (hasPermission) { return true; }

const status = await PermissionsAndroid.request(permission); return status === 'granted'; }

const GallerySelection = async () => { if (Platform.OS === 'android' && !(await hasAndroidPermission())) { return; } ImagePicker.openPicker({multiple: true}) .then((images) => { console.log(images); }) .catch((error) => { console.log(error); }); };

juliendevleeschauwer avatar Dec 01 '21 14:12 juliendevleeschauwer

It may just filename character issure。rename your video or image, try again. it works for me

zhuliminl avatar Dec 07 '21 09:12 zhuliminl

Same issue here when selecting with gallery. I have Huawei Honor 8x!!!

MuhammadRafeh avatar Jan 30 '22 17:01 MuhammadRafeh

Same issue with

  • Huawei Mate 20 Light

  • Huawei Mate 30

  • Samsung Galaxy M12

  • OS: Android 10

#1722

fatihyildizhan avatar Feb 06 '22 19:02 fatihyildizhan

image crop picker works fine to select one photo but when i select multiple photos i get Invalid image selected Can someone help me

MuhammadTufailAli avatar May 19 '22 14:05 MuhammadTufailAli

try version https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.38.0

ivpusic avatar Jun 29 '22 08:06 ivpusic

Description

Selecting images captured by Huawei devices (mainly P30 and P30 Pro) resulted in error "Invalid image selected". There is no error on other android devices/images that are on Huawei devices but captured by other phone. Suspect bug is on image information returned by Huawei devices.

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.32.2
  • react-native v0.62.2

Platform

Tell us to which platform this issue is related

  • Android 10
  • Huawei P30 & Huawei P30 Pro

Expected behaviour

  1. Open gallery
  2. Select one or more image(s)
  3. Image details returned properly

Actual behaviour

  1. Open gallery
  2. Select one or more image(s)
  3. Promise rejected with error "Invalid image selected"

Steps to reproduce (Huawei P30 series)

  1. Open picker -> navigate to gallery
  2. Select one or more image(s) that are captured with the phone itself
  3. Confirm selection
  4. Promise rejected with error "Invalid image selected"

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

PR https://github.com/ivpusic/react-native-image-crop-picker/pull/1722 was merged

ddikodroid avatar Aug 17 '22 02:08 ddikodroid