image - 下载 URL 和图像 URL 之间的区别
问题描述
我将用户个人资料图像存储在 firebase 中。Firebase 将这样的网址返回给我https://firebasestorage.googleapis.com/v0/b/offere-5ad35.appspot.com/o/USERS%2Fqy5SNzVlI7ZNIFeWVnNSZfv1cy22%2Fprof_picture.jpg?alt=media&token=61fab7ff-8f1d-46fb- a1e2-5ffc8be0b00e。
这似乎是下载图像而不是在浏览器中显示它。这意味着我不能在我的 React Native 图像标签中使用它。有没有办法将其转换为普通的图像资源 URL。
还是我必须手动获取它并将其存储在设备上?
解决方案
我在这里绊倒了自己。
问题是我试图设置<Image source={url} />
,并且我收到控制台警告“尝试为 Image 组件设置无效的源。
问题不在于 url 无效,而在于我应该一直使用这种语法
<Image source={{uri: https://firebasestorage.googleapis.com/v0/b/offere-5ad35.appspot.com/o/USERS%2Fqy5SNzVlI7ZNIFeWVnNSZfv1cy22%2Fprof_picture.jpg?alt=media&token=61fab7ff-8f1d-46fb-a1e2-5ffc8be0b00e.}}
推荐阅读
- html - 文本没有在中间对齐
- java - 将字符串转换为时间戳会提供额外的“0”
- flutter - 如何在颤动中制作滚动视图?
- c++ - 尝试将 C++11 代码转换为 C++03 时默认函数模板参数出错
- c# - 为什么当我使用 process.WaitForInputIdle 时进程总是不空闲?
- c# - 确认
声明是正确的,程序集及其所有依赖项都可用 - r - Is there a way to group_by a variable, str_detect in each group and store that result in a new column?
- reactjs - 如何处理 React-admin 中的服务器错误?
- excel - 创建字符串的变体数组(数字或字符串的混合数据)
- php - Jquery 和 Ajax 不将数据发布到或加载 PHP 页面