react-native-image-picker, icloud image problem

Viewed 60

i've been using react-native-image-picker in my app. The problem is with the "launchImageLibrary" function. This function opens the default image library of the device, and lets you select image/images from there. Here is the thing:

  • When i select a photo from the library while the icloud storage optimization is off, which means all the photos are stored in the device, there is no problem.
  • When i try the select a photo while the icloud is active and the selected photo is stored in icloud i get a response like this;
fileName: "blabla.jpg"
height: 0
type: "image/jpg"
uri: "file:///var/mobile/Containers/Data/Application/blabla.jpg"
width: 0

This response is taken from the code that looks like this

 const result = await launchImageLibrary(
      {
        mediaType: 'photo',
        includeBase64: true,
        maxHeight: 600,
        maxWidth: 600,
      },
      val => {
        console.log(val, 'callback response');
      },
    );
    console.log(result, 'response');

In the librarys github https://github.com/react-native-image-picker/react-native-image-picker it says that the callback object should return an error, but the callback returns the same value as the result object.

How can i correctly get the response from here, or is there any way to set some sort of loading for this problem.

Final notes: When the icloud photo optimization is active and the option to get images while using cellular data is true, library downloads the photo on its own but still doesnt return any value about this download process.

Here is some versions:

"react-native": "0.67.3",
"react-native-image-picker": "^4.8.4",
"react": "17.0.2",
```

Has anyone encountered this issue, is it possible to overcome it somehow, or should i use some other library to fix this problem?
0 Answers
Related