我用 expo 相机模块制作了一个相机应用程序,我现在正试图访问这个应用程序中的特定相册,就像它发生在移动原生相机应用程序中一样。我尝试按照我看到的一些模糊说明创建一个类似的函数,但我不知道这是正确的路径。
//trying to access photos taken through the square
const albumName = "Gryffindor";
async function seePhotos() {
const getTakenPhotos = await MediaLibrary.getAssetsAsync({
first: 20,
album: albumName,
sortBy: ["creationTime"],
});
console.log(getTakenPhotos.assets);
return MediaLibrary.getAssetsAsync.asset.uri;
}
<View style={{ flex: 1, alignItems: "center" }}>
<Icon name="square" size={50} color="white" onPress={seePhotos} />
</View>;