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

Gesture.Exclusive functionality differs on iOS vs Android #1848

Closed
1 of 2 tasks
zibs opened this issue Jan 26, 2022 · 6 comments
Closed
1 of 2 tasks

Gesture.Exclusive functionality differs on iOS vs Android #1848

zibs opened this issue Jan 26, 2022 · 6 comments
Labels
BugBash 31.03 Close when stale The issue will be closed automatically if it remains inactive Platform: Cross platform inconsistency This issue presets the library behavior inconsistency between platforms

Comments

@zibs
Copy link

zibs commented Jan 26, 2022

Description

I'm copying examples from the docs and came across the double tap example. It seems to work fine on Android, but not on iOS.

Platforms

  • iOS (not working)
  • Android (working)

Steps To Reproduce

  1. I made an mvce example repo here. It's using expo, just yarn and yarn start and run iOS/Android as desired. You'll see on iOS the single is always logged (and the others never fire), but on Android they fire as expected.

Expected behavior

I would expect Gesture.Exclusive to function as it does on Android, prioritizing the order of the gestures passed in. I've tried using onStart instead of onEnd as found in the docs here (which are slightly out of date with the maxDurationMs prop) and ended up going with this example found here

Actual behavior

On iOS, it seems like the single tap inevitably steals the gesture and always logs itself. If I comment out the single tap and run it as just double/triple, only double tap works (even though, again, I'd expect triple to take priority)

Snack or minimal code example

Example repo here

Package versions

  • React: 17.0.1
  • React Native: 0.64.3 (generic expo init using 44.0.0)
  • React Native Gesture Handler: ~2.1.0
  • React Native Reanimated: ~2.3.1
@j-piasecki j-piasecki added the Platform: Cross platform inconsistency This issue presets the library behavior inconsistency between platforms label Jan 27, 2022
@j-piasecki
Copy link
Member

Hi! This seems to be related to #1804 as I was able to reproduce it only in managed workflow.

@zibs
Copy link
Author

zibs commented Jan 27, 2022

Thanks @j-piasecki, you're right. I ejected from expo and both platforms work fine.

@homosape
Copy link

Hi, any updates with this issue?

@samtgarson
Copy link

Just keeping this alive—I can't comment on whether this exists with the bare workflow but at the moment it seems Exclusive is not functional on iOS, with latest dependencies.

Anyone aware of any other way to implement single and double tap gestures on the same View in this context?

@slytter
Copy link

slytter commented May 23, 2022

@samtgarson you can use Gesture.Race

const tapGesture = Gesture.Tap().onEnd((event) => {
    // your single tab code
})

const doubleTab = Gesture.Tap().numberOfTaps(2).onEnd(() => {
    // your double tab code
})

const singleAndDoubleTab =  Gesture.Race(tapGesture, doubleTab)

@samtgarson
Copy link

@slytter this always calls the single tap callback in my test.

I would have thought that the single tap would always register before the double tap, so Race would always end up calling the single tap callback anyway?

@j-piasecki j-piasecki added the Close when stale The issue will be closed automatically if it remains inactive label Dec 20, 2023
@github-actions github-actions bot closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugBash 31.03 Close when stale The issue will be closed automatically if it remains inactive Platform: Cross platform inconsistency This issue presets the library behavior inconsistency between platforms
Projects
None yet
Development

No branches or pull requests

6 participants