-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onPress works on Circle element, but not on Image element #1170
Labels
Comments
Hmm, this seems to work fine for me: import React from 'react';
import {SafeAreaView, StatusBar} from 'react-native';
import {Svg, Image} from 'react-native-svg';
const App = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<Svg height="100%" width="100%" style={{backgroundColor: '#222'}}>
<Image
x="5%"
y="5%"
width="90%"
height="90%"
href={require('./img.png')}
onPress={(...args) => alert('Image onPress', args)}
/>
</Svg>
</SafeAreaView>
</>
);
};
export default App; Can you make a full reproduction? |
Seems it's not working on android actually |
msand
added a commit
that referenced
this issue
Oct 25, 2019
msand
pushed a commit
that referenced
this issue
Oct 25, 2019
## [9.13.3](v9.13.2...v9.13.3) (2019-10-25) ### Bug Fixes * **android:** Image onPress [#1170](#1170) ([5c967b7](5c967b7))
Can you try with v9.13.3 in a plain react-native or ejected expo project? |
Thanks a lot for the fix. Works fine in plain react-native + 9.13.3 |
This was referenced Apr 19, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question
<Circle onPress={()=>handleMarkerTouch(key)} cx={scaleX(x)} cy={scaleY(y)} r={5} fill={'#367be2'}/>
<Image onPress={()=>handleMarkerTouch(key)} x={scaleX(x) - MarkerWidth/2} y= {scaleY(y) - MarkerHeight} width={MarkerWidth} height={MarkerHeight} href={imageResouce} />
I'm trying to use onPress for an image element inside an SVG. It doesn't trigger any onPress events. However if I try that on a Circle element, it works.
I also tried the TouchableOpacityG hack suggested by @msand on this expo (https://snack.expo.io/@msand/touchableopacityg).
Can anyone please guide on what could be the mistake I'm doing?
The text was updated successfully, but these errors were encountered: