How can I automatically scale an SVG element within a React Native View?

后端 未结 4 989
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 01:10

I am trying to put a react-native-svg element inside of a View such that it\'s rendered with a certain, fixed aspect ratio, but then scaled to be as la

4条回答
  •  逝去的感伤
    2021-02-07 01:39

    For my SVG, I was using those provided at https://material.io/resources/icons

    What fixed it for me, was to make sure you don't mess with the viewBox or given values in the Paths (like I did) but only change the height and width to fill and then use the containers like the other answers:

    
        
            
                
                
            
        
    
    

提交回复
热议问题