Eya*_*alS 9 android react-native
在 android 中使用以下反应本机包:
"react-native": "0.47.2"
"react-native-document-picker": "2.0.0" (removing the ovveride to compile with 0.47)
"react-native-fetch-blob": "^0.10.8"
Run Code Online (Sandbox Code Playgroud)
我在使用 react-native-document-picker 或 react-native-contacts(用于头像)时得到一个 content:// uri。像这样的 URI:
'content://com.android.providers.media.documents/document/image%3A99'
Run Code Online (Sandbox Code Playgroud)
尝试访问此文件失败,并显示“stat 错误:无法列出路径 null,因为它不存在或不是文件夹”
const urlDecoded = decodeURIComponent(url);
return new Promise((resolve, reject) => {
RNFetchBlob.fs.stat(urlDecoded)
.then(resolve)
.catch(reject);
});
Run Code Online (Sandbox Code Playgroud)
知道如何访问文件吗?访问的真实路径吗?
现在react-native-fs中已经有了针对这个问题的解决方案。启用访问和复制 content:// 文件 - https://github.com/itinance/react-native-fs/pull/395
| 归档时间: |
|
| 查看次数: |
7288 次 |
| 最近记录: |