Open ddzirt opened 5 years ago
Not the maintainer but it appears you're using the component wrong. You're supposed to have
<SvgPanZoom ...>
{any svg elements}
</SvgPanZoom>
not
<SvgPanZoom ...>
<Svg>
{any svg elements}
</Svg>
</SvgPanZoom>
as per the documentation not that the first snippet does not instantiate Svg inside SvgPanZoom.
If we add
For example: `<SvgPanZoom canvasHeight={500} canvasWidth={500} minScale={0.5} initialZoom={0.7} onZoom={zoom => { console.log('onZoom:' + zoom); }} canvasStyle={{ backgroundColor: 'yellow' }} viewStyle={{ backgroundColor: 'green' }}
while this will work:
<Svg viewBox="0 0 100 100" width={width} height={height}> <Rect fill="black" x="0" y="0" width="100" height="100" onPress={() => Alert.alert('press')} /> <Image x="0" y="0" width="100" height="100" href={require('./assets/Kingfisher.jpg')} onPress={() => Alert.alert('press')} /> </Svg>