ivpusic / react-native-image-crop-picker

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

Image picker reloads app when trying to pick an image for cropping #910

Open edyrydberg opened 5 years ago

edyrydberg commented 5 years ago

Version

Tell us which versions you are using:

Platform

Tell us to which platform this issue is related -Android - This issue is happening on android platform

Expected behaviour

Load the selected image for cropping

Actual behaviour

Reloads the app thereby exiting the screen/page for cropping

Attachments

// stacktrace or any other useful debug info

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

DKSoftwares commented 5 years ago

I am having the same problem, any additional info is needed?

nwaughachukwuma commented 5 years ago

@ivpusic @ishigamii I have same challenge. What could be the problem? @edyrydberg @DKSoftwares you found any solution yet?

ishigamii commented 5 years ago

@edyrydberg can you show us the code you are using ? is this still going on for you or you find a solution?

edyrydberg commented 5 years ago

@edyrydberg can you show us the code you are using ? is this still going on for you or you find a solution?

@ishigamii @ishigamii @nwaughachukwuma am still having this issue ooh. Its not reliable, it works well sometimes, somtimes too its reloads the app as before.

ishigamii commented 5 years ago

@edyrydberg I am currently using the same version and I don't have this problem so maybe showing use some code would help ;)

edyrydberg commented 5 years ago

@ishigamii this is my code. hope this helps.

ImagePicker.openPicker({ width: 300, height: 400, cropping: true }).then(image => { this.setState({loading:true}) let userId = this.getAuthUserId(); firebase.storage() .ref('/users/user_'+userId+'.jpg') .putFile(image.path) .then(uploadedFile => { updateUser(userId, uploadedFile.downloadURL); this.getUserFromDB(); this.setState({loading:false}) alert('Profile picture updated successfully'); }) .catch(err => { //Error console.log(err) });
});

ishigamii commented 5 years ago

@edyrydberg did you try to remove the code inside the then and just let the log. Can you try and tell me if it still does the same ?

ImagePicker.openPicker({
width: 300,
height: 400,
cropping: true
}).then(image => {
console.log(image);
})
.catch(err => {
//Error
console.log(err)
});
edyrydberg commented 5 years ago

@edyrydberg did you try to remove the code inside the then and just let the log. Can you try and tell me if it still does the same ?

ImagePicker.openPicker({
width: 300,
height: 400,
cropping: true
}).then(image => {
console.log(image);
})
.catch(err => {
//Error
console.log(err)
});

Just tried that and everything works fine. I've noticed something as well. When I open image from the storage itself(phone storage or SD card) everything works perfect. However, opening image from gallery reloads the app, any explanation why that happens @ishigamii .

To Anyone having same issue, this might be the cause.

@ishigamii Thanks for the help. really appreciate it.

AbhishekNairOfficial commented 4 years ago

The app reloads for me most of the time when I select an image from the camera, but works fine when selecting an image from the gallery / storage.

This is my code: const image = await ImagePicker.openCamera({ width: 300, height: 400, cropping: true, });

react-native-image-crop-picker: v0.26.1 react-native: v0.61.5