react-native-image-crop-picker
react-native-image-crop-picker copied to clipboard
"Invalid image selected" for images captured by Huawei device.
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
- Open gallery
- Select one or more image(s)
- Image details returned properly
Actual behaviour
- Open gallery
- Select one or more image(s)
- Promise rejected with error "Invalid image selected"
Steps to reproduce (Huawei P30 series)
- Open picker -> navigate to gallery
- Select one or more image(s) that are captured with the phone itself
- Confirm selection
- 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
Same issue on Nexus S that is also running Android 10.0
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"
Same issue Redmi K30 Ultra react-native-image-crop-picker v0.35.0 react-native v0.63.2
Same issue here on Android 10:
"react-native-image-crop-picker": "^0.33.2", "react-native": "0.61.5",
Same issue here
"react-native-image-crop-picker": "^0.35.0", "react-native": "0.63.2",
Same, Motorola G7 Play
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:
If it's a permissions issue, could this suggestion fix it https://github.com/ivpusic/react-native-image-crop-picker/issues/1419#issuecomment-702652168?
I think there would be no reason to add write permission if we just want to open picker not camera or something else.
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); }); };
It may just filename character issure。rename your video or image, try again. it works for me
Same issue here when selecting with gallery. I have Huawei Honor 8x!!!
Same issue with
-
Huawei Mate 20 Light
-
Huawei Mate 30
-
Samsung Galaxy M12
-
OS: Android 10
#1722
image crop picker works fine to select one photo but when i select multiple photos i get Invalid image selected Can someone help me
try version https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.38.0
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
- Open gallery
- Select one or more image(s)
- Image details returned properly
Actual behaviour
- Open gallery
- Select one or more image(s)
- Promise rejected with error "Invalid image selected"
Steps to reproduce (Huawei P30 series)
- Open picker -> navigate to gallery
- Select one or more image(s) that are captured with the phone itself
- Confirm selection
- 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