software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

[iOS] Stylus support #3113

Closed m-bert closed 1 month ago

m-bert commented 2 months ago

Description

This PR adds stylus support on iOS.

[!WARNING] This PR lacks support for Hover since currently we are unable to test that.

[!NOTE] You can read more about this feature in #3107

Test plan

Tested on StylusData example

m-bert commented 2 months ago

Let me answer those questions, @j-piasecki:

What about hover?

It's hard to say as currently we have no way to test it. The two options that I see are either to implement it and hope that it will work fine, or wait for a device that will allow us to check if it is properly implemented.

Either way, I think we can leave it as TODO and finish it in another PR. Let me know what do you think.

Do we want to add support for rollAngle?

I'm not sure. If we do, we should also add support for twist property (I guess they will be similar). Sadly, my phone doesn't support twist so I was unable to test that. Also I'll have to check if our device does support rollAngle.

The other reason why I have not added it yet is because there's no such thing on Android (at least I haven't seen anything like that in docs).

So in my opinion we can add it, but it is not a big deal if it's missing. What's your stance on that?

j-piasecki commented 2 months ago

I guess we can add it in the future alongside hover.

tomekzaw commented 1 month ago

Please build this PR for visionOS simulator prior to merging

m-bert commented 1 month ago

Please build this PR for visionOS simulator prior to merging

I've just done it and it builds. I'll check it one more time if the code changes 😅

RuudBurger commented 4 weeks ago

This seems to be breaking tvOS. I get Property 'stylusData' not found on object of type 'RNBetterPanGestureRecognizer *' for this line withStylusData:[panRecognizer.stylusData toDictionary]] in RNPanHandler.m

m-bert commented 4 weeks ago

Hi @RuudBurger, thanks for reporting this. Should be fixed by #3180