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

Add velocity information on macOS #2695

Closed
jfedak opened this issue Dec 15, 2023 · 2 comments · Fixed by #2706
Closed

Add velocity information on macOS #2695

jfedak opened this issue Dec 15, 2023 · 2 comments · Fixed by #2706

Comments

@jfedak
Copy link
Contributor

jfedak commented Dec 15, 2023

Description

RIght now, we don't provide any information about velocity of rotation and pinch gestures on macOS, since there is no information about it in NSRotationGestureRecognizer. It still seems that we can get this information like on Android.

Steps to reproduce

Snack or a link to a repository

Gesture Handler version

React Native version

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added Missing info Platform: iOS This issue is specific to iOS labels Dec 15, 2023
Copy link

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Steps to reproduce, Snack or a link to a repository, Gesture Handler version and React Native version sections.

@jfedak jfedak added Maintainer issue and removed Missing info Platform: iOS This issue is specific to iOS Missing repro labels Dec 15, 2023
jfedak added a commit that referenced this issue Feb 8, 2024
## Description

<!--
Description and motivation for this PR.

Include 'Fixes #<number>' if this is fixing some issue.
-->
Fixes #2695

This PR adds pinch and rotation velocity information on macOS. In order
to make it work, we needed to change a way of handling events inside
`RNRotationHandler` and `RNPinchHandler` - from now on, it uses
`rotateWithEvent` and `magnifyWithEvent` respectively. The action is
based on the state of handler.

Both handlers calculate current velocity in a similar way to [Android
handler](https://github.com/software-mansion/react-native-gesture-handler/blob/83d8e7b02b525a8a5d18dc0eb680565470daa92d/android/src/main/java/com/swmansion/gesturehandler/core/RotationGestureHandler.kt#L27-L30).

## Test plan

<!--
Describe how did you test this change here.
-->

PR was tested on `Pinch & rotate` example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant