我尝试了库react-native-svg-uri来显示我的梯度SVG,但它的背景是黑色的屏幕上所附的图片。x1c 0d1x任何是错误的,我下面的代码,而我在此链接中遵循指南:https://www.npmjs.com/package/react-native-svg
const iconSvg = require('../images/home_option2/bao_cao.svg')
<SvgUri height={96} width={96} source={iconSvg}/>
下面是SVG代码:
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
<defs>
<linearGradient id="a" x1="50%" x2="50%" y1="0%" y2="100%">
<stop offset="0%" stop-color="#68B9FE"/>
<stop offset="100%" stop-color="#627CFF"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<rect width="48" height="48" fill="url(#a)" rx="24"/>
<path fill="#FFF" d="M17.02 14.692v17.03c0 .406-.334.74-.741.74a.743.743 0 0 1-.74-.74V16.384h-.847A1.69 1.69 0 0 0 13 18.077v15.23A1.69 1.69 0 0 0 14.692 35h18.674c.899 0 1.634-.73 1.634-1.634V14.692A1.69 1.69 0 0 0 33.308 13l-14.702.106c-.936 0-1.587.65-1.587 1.586zm3.49 1.693h4.442c.407 0 .74.333.74.74s-.333.74-.74.74H20.51a.743.743 0 0 1-.74-.74c0-.407.332-.74.74-.74zm0 8.461h7.827c.407 0 .74.333.74.74 0 .408-.333.74-.74.74H20.51a.743.743 0 0 1-.74-.74c0-.407.332-.74.74-.74zm10.365 5.712H20.51a.743.743 0 0 1-.74-.74c0-.408.332-.741.74-.741h10.365c.407 0 .74.333.74.74 0 .408-.333.74-.74.74zm0-8.462H20.51a.743.743 0 0 1-.74-.74c0-.407.332-.74.74-.74h10.365c.407 0 .74.333.74.74s-.333.74-.74.74z"/>
</g>
</svg>
任何人都可以帮忙,拜托!
1条答案
按热度按时间s8vozzvw1#
问题出在你的. svg文件上。你可能使用了一个旧的svg标准。我转换了你的. svg文件,用新的可以正常工作。