我有一个 SVG 作为组件。当我将它的宽度设置为 100% 时,它适用于 React Native Web,但不适用于本机。
这里有一个代码链接,但是模拟器设备不够宽,无法显示问题。如果在您自己的超过 375 像素宽的设备上对其进行测试,那么您会看到问题。 https://snack.expo.io/@jamesweblondon/bold-scones
我不能在这里发布完整的组件,因为它太大了,但这是它的开始:
function SvgComponent() {
return (
<Svg
width={375}
height={337}
fill="none"
viewBox="0 0 375 337"
style={{
width: "100%",
height: "auto",
}}
>