I use a framework called react-native-svgto draw SVG elements in my own edited form.
My goal is that when I click on a view (I use PanResponderin the global view to get this), the element that is closest to switches.
I have everything I need except one: I need to know the position of my svg elements, as well as their size, to find the one that was closest to the tap event.
Now I tried most of the available things, I would say:
onLayout: these svg elements are not representations and therefore do not call the onLayout callback.this.refs.elem.measure: are the same as onLayoutthey are not representations, therefore the function is measureundefined.UIManager.measure(ReactNative.findNodeHandle(this.refs.elem), callback): returns 0 for all values except the Svg component of reaction-native-svg, but not for all others: G, Path, Line, etc.
So I was wondering if there is some other solution or if I am doomed. :) Do I have to change something in response-native-svg that would allow me to find these values or is there any solution for me ?
Thank!
source
share