-
-
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
Touch events fire for different targets on Android #433
Comments
I have a similar Issue, but i have attached the pan-responder to a View which contains a This bug makes using panresponder around svg's nearly unusable |
I forgot to post, but I found what the problem was and found a (non-ideal) workaround. SVG events don't have correct locationX and locationY - they are fixed, so because of the way I had it set up, I was getting both events from the root SVG, which were wrong and events from the child object, which were correct. |
Hey @psivanov, could you elaborate on your workaround please, I am actually facing the same issue. |
@sabativi, I simply found a way to do what I needed without using locationX and locationY in my event handler. I used pageX and pageY, instead. In my case, I know exactly where on the page the canvas component is located, so could get the canvas location this way. |
Thank you a hundred times :) I used the gestureState moveX and moveY, which I believe is the same as the pageX and pageY, as well as a known offset of the view on the screen. You can get the known offset of the view using where _topSvg is the ref of the topmost svg in your render function. |
I think I might have fixed the issue now, can you try with the latest commit from the master branch? |
Closing because of inactivity. |
I am using a PanResponder attached to a
<G>
element and have implemented simple dragging.On Android, there are events fired for at least two different target (sometimes more), while I drag.
The locationX and locationY of these events are not the same, which results in my
<Path>
element jumping back and forth between the two different locations.Also, I noticed that the target of the event, which is passed to
onStartShouldSetPanResponder
is always different than the target passed toonPanResponderRelease
.Below is the log, in the form
event handler: target [[[locationX, locationY]]]
EDIT:
Looks like 270 is the id of the root
<SVG>
element, while 274 is the id of the child<G>
, which I care about. 270 locationX/Y never update, so I can't really use it. It kind of works, if I just ignore anything but the first target (274 in this case) I get. The problem is that if I move my finger fast enough, I stop getting the child (274) events and I am only getting the root events, which are useless. So in this case the dragging is interrupted.Android:
iOS:
The text was updated successfully, but these errors were encountered: