Skip to content
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

Make Gesture Handler on web respect simultaneousHandlers prop when used on a ScrollView #2125

Merged
merged 5 commits into from
Aug 18, 2022

Conversation

j-piasecki
Copy link
Member

@j-piasecki j-piasecki commented Jul 14, 2022

Description

Should fix #2091

HammerJS (which is used by Gesture Handler on web) by default tries to use pointer events, which can be cancelled when the browser starts recognizing its own gestures (e.g. scrolling). Because of that all gestures would fail upon receiving pointercancel event. This is not the case when using touch events, which do not get cancelled.
This PR forces Hammer to use touch events when a gesture is simultaneous with a NativeViewGestureHandler and keeps its default behavior in other cases. This way the gesture keeps receiving events event when a browses is handling a gesture be itself.
Unfortunately, I don't think we can accomplish feature-parity between web and native platforms using Hammer. For example, one of the missing things is the possibility to prevent the scroll from starting.

Test plan

Tested on the Example app and on the code from the issue.

@j-piasecki j-piasecki marked this pull request as draft July 14, 2022 11:07
@j-piasecki j-piasecki marked this pull request as ready for review July 19, 2022 07:53
@j-piasecki j-piasecki force-pushed the @jpiasecki/fix-web-simultaneous-with-native branch from 427c247 to 094342c Compare July 19, 2022 08:06
src/web/GestureHandler.ts Outdated Show resolved Hide resolved
src/web/GestureHandler.ts Outdated Show resolved Hide resolved
j-piasecki and others added 2 commits August 2, 2022 14:06
Co-authored-by: Tomek Zawadzki <tomekzawadzki98@gmail.com>
Co-authored-by: Tomek Zawadzki <tomekzawadzki98@gmail.com>
@tomekzaw
Copy link
Member

tomekzaw commented Aug 3, 2022

Oops, looks like the changes I've suggested are not formatted properly.

@j-piasecki j-piasecki merged commit 9a4bef2 into main Aug 18, 2022
@j-piasecki j-piasecki deleted the @jpiasecki/fix-web-simultaneous-with-native branch August 18, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WEB] Pan Gesture and Native Gesture do not work simultaneously!
2 participants