question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TouchableOpacity inside SVG not clickable

See original GitHub issue

Hello all,

I have an issue where TouchableOpacity doesn’t trigger onPress events when it’s nested inside svg element. For same feature, I have different implementation where TouchableOpacity on Android is outside svg element and it registers tap just fine. As soon as it’s inside header it just stops working.

react-native-svg: "7.0.3."

Any ideas? Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

2reactions
msandcommented, Oct 29, 2018

I don’t think we’ve had support for that yet. Would be nice to have though. You can use onPress directly on the svg elements for now, or isolate the part you want touchable to animate in a separate svg root which you wrap with touchable. This will allow it to just change the opacity of the already rendered svg, rather than re-render its content each frame of the animation.

1reaction
chialukacommented, Feb 3, 2021

Hello @msand, any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TouchableOpacity inside SVG not clickable #826 - GitHub
Hello all,. I have an issue where TouchableOpacity doesn't trigger onPress events when it's nested inside svg element.
Read more >
Touchable opacity on press not working inside SVG tags
The reason for that is that SVG is at the top as parent element, disabling the accessibility to TouchableOpacity . This means the...
Read more >
Touchable opacity on press not working inside SVG tags ...
The reason for that is that SVG is at the top as parent element, disabling the accessibility to TouchableOpacity . This means the...
Read more >
ReactNative: using SVG as a button - Krasimir Tsonev
Using an SVG as a button is one of them. Find my solution below and expect more ... The transparent bits of the...
Read more >
Is there a way to do a touchableOpacity button without ... - Reddit
I am trying to do a circular button using touchableOpacity in react native, ... of the rectangle remain clickable, which is not what...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found