react-native - 如何通过expo react native访问路径包含照片文件夹

标签 react-native expo

我正在使用 downloadAsync来自 FileSystem的世博会下载图像。它将图像从 Expo.FileSystem.cacheDirectory 返回到文件夹中.但我不知道如何将图像下载到设备上的照片文件夹中。
请帮帮我enter image description here

这是一个 uri下载后被退回 file:///Users/hoaitruong/Library/Developer/CoreSimulator/Devices/937033C0-A523-4F7E-88E0-C203329FDDC3/data/Containers/Data/Application/8459E190-D882-43BE-9E16-3C219D325EAC/Library/Caches/ExponentExperienceData/%2540anonymous%252Fsigma-b280412d-e7ec-4029-a358-68197e79cfaa/img-5843_orig.jpg
这是我的代码:
FileSystem.downloadAsync( attachment.imageUrl, FileSystem.cacheDirectory + attachment.fileName )

最佳答案

更改 FileSystem.cacheDirectoryFileSystem.documentDirectory

关于react-native - 如何通过expo react native访问路径包含照片文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48919643/

相关文章:

reactjs - 由于在它们之前返回,因此无法看到条件渲染

reactjs - React 导航栏标题左侧有边距

ios - 根据背景颜色调整图标颜色

ios - 如何在 React Native 应用程序中使用 GameCenter

react-native - Expo DevTools 显示发生意外错误

javascript - 如何在胜利 native 的面积图中制作可拖动光标

ios - Expo - 减少 iOS 设备上的 PDF 文件大小

react-native - 世博会不会运行应用程序错误 : could not connect to TCP port 5554: cannot connect to 127. 0.0.1:5554:

ios - react 导航滑动返回不会触发

javascript - 获取单个数据后如何强制 Flatlist 重新渲染?