React Native SVG:全屏自适应 viewBox

问题描述 投票:0回答:2
reactjs react-native svg react-native-svg
2个回答
0
投票

修复者

    const viewBox = '0 0 '+this.state.screenWidth+' '+this.state.screenHeight;
    return <Svg viewBox={viewBox} style={styles.wrapper}>

我认为这不是最好的解决方案,但它是有效的


0
投票
<YourSVG
  width={undefined}
  height={undefined}
  style={{width: '100%', height: '100%'}}
  preserveAspectRatio="none"
/>
© www.soinside.com 2019 - 2024. All rights reserved.