[英]How to use SVG in Expo SDK 40 React Native with TypeScript?
I tried to use a svg in expo sdk 40 width: react-native-svg-transformer我尝试在 expo sdk 40 中使用 svg 宽度:react-native-svg-transformer
Here is the process i followed:这是我遵循的过程:
I got an error saying: it was expected string type but received a number我收到一条错误消息:这是预期的字符串类型,但收到了一个数字
I want to use this svg: example vsg drawing by logiciel adobe我想使用这个 svg:由 logiciel adobe 绘制的示例 vsg 绘图
Before the SDK 40, the process was working Thanks for Help !在 SDK 40 之前,该过程正在运行 感谢您的帮助!
SVG in Expo SDK 40 SVG 在 Expo SDK 40
react-native-svg
allows you to use SVGs in your app, with support for interactivity and animation. react-native-svg
允许您在应用程序中使用 SVG,支持交互性和 animation。
expo install react-native-svg
import * as React from 'react';
import Svg, { Circle, Rect } from 'react-native-svg';
export default function SvgComponent(props) {
return (
<Svg height="50%" width="50%" viewBox="0 0 100 100" {...props}>
<Circle cx="50" cy="50" r="45" stroke="blue" strokeWidth="2.5" fill="green" />
<Rect x="15" y="15" width="70" height="70" stroke="red" strokeWidth="2" fill="yellow" />
</Svg>
);
}
How to use svg files in React-Native with Typescript Click here如何在 React-Native 和 Typescript 中使用 svg 文件点击这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.