react-native-gesture-handler
react-native-gesture-handler copied to clipboard
Fix possible web crashes
Description
Without being able to reproduce, we saw some possible web crashed happening in react-native-gesture-handler. So adding more guards to avoid that
Here are the sentry crashed :
Hi @billouboq! First of all, thanks for this PR! Is there any stack trace for the first error? Looking at the code, situation where last coordinates are undefined shouldn't happen in this function, so it would be great to see what causes that behavior.
@m-bert Unfortunatly, we couldn't have more details about that, it was only showing in Sentry and not a single user reported an issue, and we cannot reproduce on our side
Okay, I'll try to find out what is the root cause. What Gesture Handler version do you use? I assume it was reported on 2.25.0
Hi again @billouboq! Unfortunately I was not able to reproduce it, though I think it may be caused by one of the following:
- Pointer is removed form
PointerTrackerbefore handler entersBEGANstate - removing may happen for example when one lifts pointer from the view. PointerTrackeris reset before handler entersBEGANstate - this one can happen whenpointercancelevent is received.
For now I can't see any other possibility, but also I'm not sure how Gesture Handler may enter one of those two states.
Either way, we decided to fix it in a different way (which hopefully will work). I created #3565 which should solve this problem. It would be great if you could test it, but I understand that it may be challenging.
About this PR, please leave only the second fix, for hasPointerCapture - if CIs pass then we can merge it 😅
Hi @billouboq! Just to let you know, I've merged #3565, so these changes are no longer necessary in this PR
Thanks a lot for the changes ! 🙏
So are you willing to contribute to fix the other crash? 😅 If so, please leave only changes in PointerEventManager
Will do right now otherwise I know I will never take the time to do it 😁
@m-bert Done