Open
Description
Description
On MacOS, <Svg>
components do not crop their children properly.
Android | MacOS |
---|---|
![]() |
![]() |
Minimal repro
import React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import Svg, { Circle } from 'react-native-svg';
export default function SvgExample() {
return (
<View style={styles.container}>
<Text style={styles.header}>SvgView with SvgView with ViewBox</Text>
<View style={{ backgroundColor: 'tomato' }}>
<Svg
height="250"
width="250"
viewBox="-50 -50 150 150"
onPress={() => console.log('SVG: clicked viewbox container')}>
<Svg
height="250"
width="250"
viewBox="-300 -300 600 600"
onPress={() => console.log('SVG: clicked inner viewbox container')}>
<Circle
r="300"
fill="green"
onPress={() => console.log('SVG: clicked viewbox circle')}
/>
</Svg>
</Svg>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
marginBottom: 48,
},
header: {
fontSize: 18,
fontWeight: 'bold',
margin: 10,
},
});
Steps to reproduce
- Open the repro on Android
- Open the repro on MacOS
- See how on MacOS, the yellow and green shapes overflow out of their parent
Snack or a link to a repository
SVG version
15.11.2
React Native version
0.79.2
Platforms
macOS
JavaScript runtime
Hermes
Workflow
Expo Dev Client
Architecture
Fabric (New Architecture)
Build type
Debug app & dev bundle
Device
Real device
Device model
MacBook
Acknowledgements
Yes