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

[macOS] Add `NativeViewGestureHandler` #3004

Closed m-bert closed 4 months ago

m-bert commented 4 months ago

Description

[!IMPORTANT] This PR supersedes #2724

This PR brings NativeViewGestureHandler to macOS. With this change, our buttons should now work properly.

Closes #2697 Closes #2724

Test plan

Test code ```tsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import { Gesture, GestureDetector, RectButton, } from 'react-native-gesture-handler'; export default function EmptyExample() { const g = Gesture.Native() .onTouchesDown((e) => { 'worklet'; console.log(e); }) .onTouchesMove((e) => { 'worklet'; console.log(e); }) .onTouchesUp((e) => { 'worklet'; console.log(e); }); return ( ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'space-around', }, button: { width: 300, height: 100, borderRadius: 25, backgroundColor: 'crimson', }, box: { width: 100, height: 100, borderRadius: 10, backgroundColor: 'plum', }, }); ```