javascript - SVG图片未在本机反应中显示
问题描述
有人可以帮我理解为什么这个 svg 没有渲染到我的屏幕上吗?
const fireee = this.state.h.map(e => {
<SvgUri
width="10%"
height="10%"
uri="https://s3.us-east-2.amazonaws.com/nomics-api/static/images/currencies/btc.svg"
/> }
)
return (
<View>
{fireee}
</View>
解决方案
const fireee = this.state.h.map((e) => {
if (e.logo_url.includes('svg')) {
console.log(e.logo_url);
return (
<SvgUri
width="3%"
height="3%"
uri={e.logo_url}/>
);
} else {
return (
<Image
source={{ uri: e.logo_url }}
style={{ width: 20, height: 20, left: '20%' }}
/>
)
}
});
需要创建一个条件来处理 svg 和 png 不同
推荐阅读
- amazon-web-services - AWS EMR 中的 Spark 物理内存问题
- python - 使用定时线程终止查询
- facebook - Facebook 应用审阅者登录时 HybridAuth 失败
- c - 包含头文件时如何确保在整个程序中仅创建变量的单个副本
- python - def __del__ 如何返回值
- tableau-api - Tableau 抑制空热图元素
- c# - C# 检查按下了什么按钮
- haskell - 在 NixOS 中使用堆栈 1.8.0(当前的“堆栈升级 --git”)?
- ms-access - 如何保护我的程序免受“非法”复制?
- mongodb - GCP 应用引擎中的 Mongo 数据库