我的react-native项目中有这段代码
CameraRoll.getPhotos({
first: 20,
assetType: "Photos",
}).then((answer) => {
dispatch({
type: PHOTOS_LIBRARY,
photos: answer.edges,
});
console.log(answer.edges);
})
.catch((err) => {
console.log(err);
});
它在我的旧 Android 设备上运行良好,但不适用于模拟器和更强大的设备,它不显示照片,事实上,它返回照片对象,但尺寸为空。 这个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}]
最佳答案
您是否尝试过在 CameraRoll.getPhotos () 方法中使用 include ? 例如:
CameraRoll.getPhotos({
first: 25,
assetType: 'Photos',
include: ['filename', 'imageSize'],
})
关于android - CameraRoll 不显示 Android 上的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63708533/