Lynx/Modules/Gestures
@sigx/lynx-gestures · Stable

Gestures#

Frame-locked touch handling on the main thread — Pressable, Draggable and Swipeable components plus composable useTap / usePan / usePinch / useSwipe hooks.

31k weekly v0.4.1 iOS · Android MIT

Installation#

Terminal
pnpm add @sigx/lynx-gestures

Components#

TSX
import { Pressable, Swipeable } from '@sigx/lynx-gestures';

<Swipeable onSwipeLeft={archive} onSwipeRight={remove}>
    <Pressable onPress={open}>
        <Text>Swipe or tap me</Text>
    </Pressable>
</Swipeable>

Hooks#

Gesture handlers run as worklets on the main thread — touch tracking never waits on the background thread, so dragging stays locked to the frame rate.

TSX
import { usePan } from '@sigx/lynx-gestures';
import { useSharedValue } from '@sigx/lynx';

const x = useSharedValue(0);
const pan = usePan((e) => { x.value = e.translationX; });

Composition#

Combine recognizers with useGesture — simultaneous, exclusive or sequenced:

TSX
const gesture = useGesture([pinch, pan], { simultaneous: true });

Next steps#

Pair with Motion for spring-driven follow-through, or see the API reference.