Skip to content

Latest commit

 

History

History
22 lines (21 loc) · 412 Bytes

File metadata and controls

22 lines (21 loc) · 412 Bytes
import { usePanGesture } from 'react-native-gesture-handler';

function Ball() {
  // ...
  const gesture = usePanGesture({
    onBegin: () => {
      isPressed.value = true;
    },
    onUpdate: (e) => {
      offset.value = {
        x: offset.value.x + e.changeX,
        y: offset.value.y + e.changeY,
      };
    },
    onFinalize: () => {
      isPressed.value = false;
    },
  });
  // ...
}