我想转换Rect。
我有svg图片。我有小矩形,我想旋转。图像完美地在网络上工作。但它给出了本机安卓应用程序的问题。
下面是svg image xml
<Svg version="1.1" id="Layer_1" x="0px" y="0px"
width="135" height="39" viewBox="0 0 135 39" enable-background="new 0 0 135 39" >
<Rect x="71.411" y="17.171" transform="matrix(-0.7072 0.707 -0.707 -0.7072 142.588 -17.6385)" fill-rule="evenodd" clip-rule="evenodd" fill="#FDC28E" width="7.07" height="7.07"/>
<Rect x="57.244" y="17.172" transform="matrix(-0.707 0.7072 -0.7072 -0.707 118.3964 -7.6375)" fill-rule="evenodd" clip-rule="evenodd" fill="#FDC28E" width="7.072" height="7.07"/>
<Rect x="83.946" y="19.874" fill-rule="evenodd" clip-rule="evenodd" fill="#d3d3d3" width="40.833" height="1.667"/>
<Rect x="9.946" y="19.874" fill-rule="evenodd" clip-rule="evenodd" fill="#d3d3d3" width="40.833" height="1.667"/>
</Svg>
我收到了警告
Warning: Failed prop type: Invalid prop `transform` of type `string` supplied to `Rect`, expected `object`.
我使用react-native-svg(https://github.com/react-native-community/react-native-svg)来显示svg内容。
我试图传递var对象,但它没有用完。
请指导我。我是反应原生发展的新手。
答案 0 :(得分:1)
将transform
替换为Svg组件中的Transform
。这将修复react-native-svg(https://github.com/react-native-community/react-native-svg)