Solution 1 :
Have you tried using include in your CameraRoll.getPhotos () method?
Ex:
CameraRoll.getPhotos({
first: 25,
assetType: 'Photos',
include: ['filename', 'imageSize'],
})
Solution 2 :
I had a same problem with galaxy A50 and SDK Version 29.
Fix this add this line in: android/app/src/main/AndroidManifest.xml
<application
...
android_requestLegacyExternalStorage="true"
...
android_theme="@style/AppTheme">
Problem :
I have this code in my react-native project
CameraRoll.getPhotos({
first: 20,
assetType: "Photos",
}).then((answer) => {
dispatch({
type: PHOTOS_LIBRARY,
photos: answer.edges,
});
console.log(answer.edges);
})
.catch((err) => {
console.log(err);
});
And it work nice on my old android device, but don’t work on emulator and more powerful devices, it not show photos, in fact, it return object of photos, but with null dimensions.
This console.log:
[{"fileSize": null, "filename": null, "height": null, "id": 0, "playableDuration": null,
"uri": "file:///storage/emulated/0/DCIM/Camera/IMG_20200902_153713.jpg", "width": null},
{"fileSize": null, "filename": null, "height": null, "id": 1, "playableDuration": null, "uri":
"file:///storage/emulated/0/DCIM/Camera/IMG_20200902_153653.jpg", "width": null}]
Comments
Comment posted by Владислав
Yes, thanks, it works, I already solve this problem)) Also, you need to import CameraRoll from @react-native-community/cameraroll
Comment posted by Mwibutsa Floribert
This was helpful but when I added that in