Open EskelCz opened 5 years ago
Hm, ok so this seems like a react native issue. With box-none it works on android, on the other hand it doesn't work on ios, throwing "UIView base class does not support pointerEvent value: box-none". So I guess the problem is ios now.
For anyone else running into this, here is a workaround (using pointerEvents only on android): https://snack.expo.io/@eskel/svg-pointerevents-solution
I've the same issue and the workaround didn't worked
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.
Hm, ok so this seems like a react native issue. With box-none it works on android, on the other hand it doesn't work on ios, throwing "UIView base class does not support pointerEvent value: box-none". So I guess the problem is ios now.
For anyone else running into this, here is a workaround (using pointerEvents only on android): https://snack.expo.io/@eskel/svg-pointerevents-solution
This solution worked for me.
There's wip to support pointerEvents properly https://github.com/react-native-community/react-native-svg/issues/1290 Would you mind testing the latest commit from the develop branch?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Workaround did not work for me
For the workaround, be sure to set the react-native property pointerEvents and not the svg style property pointerEvents.
The workaround did work for me. But it seems like when the parent view of the SVG is scaled the clickable area remains the same size on Android. 😢
Bug
When svg view is placed over other elements, touch events on it behave differently for ios and android. On ios it goes through to the underlying element, which is very useful. On android it doesn't, the touch event ends up in the svg, even though no shape inside it was touched.
It seems like a minor issue but for my use case it is actually absolutely critical.
Environment info
React native info output:
Library version: 9.5.1
Reproducible sample code
Here I've made a simple demo: https://snack.expo.io/@eskel/svg-pointer-events It uses expo version of react-native-svg, but I have the same issue in my app which uses the latest version here. I've also tried using touch-events='box-none' and it makes no difference at all.
Steps To Reproduce
Describe what you expected to happen: