【问题标题】:How to properly render SVG in React Native如何在 React Native 中正确渲染 SVG
【发布时间】:2021-10-01 19:28:09
【问题描述】:

嗨,在我们的 react native 应用程序中有以下代码:

import { SvgCssUri } from 'react-native-svg';

<SvgCssUri style={styles.osIcon} uri={'https://mon.zappiehost.com/images/os/' + props.data.icon} />

我什至尝试过使用简单的SvgUri(而不是SvgCssUri)

但图像仍然加载没有一些内容(黑色):

这里也是使用的原始 SVG 图像:https://raw.githubusercontent.com/librenms/librenms/master/html/images/os/proxmox.svg

【问题讨论】:

标签: reactjs react-native svg react-native-svg


【解决方案1】:

事实证明,由于 React Native SVG 没有自动填充,所以缺少黑色。

将fill={'black'} 添加到&lt;SvgUri&gt; 标记中

【讨论】:

  • 您应该将其作为错误报告给项目。
猜你喜欢
  • 1970-01-01
  • 2020-03-23
  • 2021-08-04
  • 2021-10-29
  • 1970-01-01
  • 1970-01-01
  • 2022-01-15
  • 2020-01-07
  • 2022-01-17
相关资源
最近更新 更多