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

Prop for ending pinching gesture when one finger is lifted (iOS) #1391

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

iqqmuT
Copy link

@iqqmuT iqqmuT commented Feb 28, 2021

Description

Fixes #1214.

Probably the maintainers don't want to alter the native iOS behavior with this PR, but this fork can be useful for those who want to avoid writing workarounds.

This fork adds a new boolean prop for PinchGestureHandler (iOS only): twoPointersRequired

  • false (default): no change for behavior; lets UIPinchGestureRecognizer end the gesture when the user lifts off both fingers from the view
  • true: end the gesture when the user lifts off one finger from the view

Test plan

Tested on iPhone 6s Plus.

<PinchGestureHandler twoPointersRequired={true}>
  ...
</PinchGestureHandler>

// user lifts one finger from the view.
if (_twoPointersRequired) {
self.state = UIGestureRecognizerStateEnded;
[self reset];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if calling reset is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant