/harness-claude:mobile-gesture-handlingfrom harness-claude
Implements touch gestures in React Native using Gesture Handler v2 for swipe, pan, pinch, and long press interactions. Useful for swipe-to-delete, draggable cards, pinch-to-zoom, and custom navigation gestures.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:mobile-gesture-handling still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Implement touch gestures with React Native Gesture Handler for swipe, pan, pinch, and long press interactions
Gesture objects composed with GestureDetector, replacing the old component-based API.npx expo install react-native-gesture-handler react-native-reanimated
Wrap your app root with GestureHandlerRootView:
import { GestureHandlerRootView } from 'react-native-gesture-handler';
export default function App() {
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<Navigation />
</GestureHandlerRootView>
);
}
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import Animated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
function DraggableCard() {
const translateX = useSharedValue(0);
const translateY = useSharedValue(0);
const savedX = useSharedValue(0);
const savedY = useSharedValue(0);
const pan = Gesture.Pan()
.onStart(() => {
savedX.value = translateX.value;
savedY.value = translateY.value;
})
.onUpdate((event) => {
translateX.value = savedX.value + event.translationX;
translateY.value = savedY.value + event.translationY;
})
.onEnd(() => {
translateX.value = withSpring(0);
translateY.value = withSpring(0);
});
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }, { translateY: translateY.value }],
}));
return (
<GestureDetector gesture={pan}>
<Animated.View style={[styles.card, animatedStyle]}>
<Text>Drag me</Text>
</Animated.View>
</GestureDetector>
);
}
function SwipeableRow({ onDelete, children }: Props) {
const translateX = useSharedValue(0);
const DELETE_THRESHOLD = -100;
const pan = Gesture.Pan()
.activeOffsetX([-10, 10]) // Activate only for horizontal movement
.onUpdate((e) => {
translateX.value = Math.min(0, e.translationX); // Only swipe left
})
.onEnd(() => {
if (translateX.value < DELETE_THRESHOLD) {
translateX.value = withTiming(-300, {}, () => {
runOnJS(onDelete)();
});
} else {
translateX.value = withSpring(0);
}
});
const style = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }],
}));
return (
<GestureDetector gesture={pan}>
<Animated.View style={style}>{children}</Animated.View>
</GestureDetector>
);
}
function ZoomableImage({ source }: { source: ImageSourcePropType }) {
const scale = useSharedValue(1);
const savedScale = useSharedValue(1);
const pinch = Gesture.Pinch()
.onUpdate((e) => {
scale.value = savedScale.value * e.scale;
})
.onEnd(() => {
savedScale.value = scale.value;
if (scale.value < 1) {
scale.value = withSpring(1);
savedScale.value = 1;
}
});
const style = useAnimatedStyle(() => ({
transform: [{ scale: scale.value }],
}));
return (
<GestureDetector gesture={pinch}>
<Animated.Image source={source} style={[styles.image, style]} />
</GestureDetector>
);
}
Gesture.Simultaneous() for gestures that should work together (pan + pinch) and Gesture.Exclusive() for competing gestures (tap vs. long press).const pan = Gesture.Pan().onUpdate(/* ... */);
const pinch = Gesture.Pinch().onUpdate(/* ... */);
// Both gestures active at the same time
const combined = Gesture.Simultaneous(pan, pinch);
// Only one gesture wins
const tap = Gesture.Tap().onEnd(handleTap);
const longPress = Gesture.LongPress().minDuration(500).onEnd(handleLongPress);
const exclusive = Gesture.Exclusive(longPress, tap); // Long press takes priority
return <GestureDetector gesture={combined}>{/* ... */}</GestureDetector>;
runOnJS to call JavaScript functions from gesture worklets. Gesture callbacks run on the UI thread. To call React state setters or navigation, wrap them with runOnJS.const tap = Gesture.Tap().onEnd(() => {
runOnJS(navigation.navigate)('Details');
});
const pan = Gesture.Pan()
.minDistance(10) // Minimum pixels before activation
.activeOffsetX([-20, 20]) // Only activate for horizontal movement
.failOffsetY([-5, 5]); // Fail if vertical movement exceeds threshold
RNGH v2 vs. v1: The v2 declarative API (Gesture.Pan()) replaces v1's component API (<PanGestureHandler>). v2 is composable, works directly with Reanimated worklets, and supports gesture composition natively.
UI thread execution: RNGH gesture callbacks and Reanimated worklets run on the native UI thread, not the JavaScript thread. This means gestures remain responsive even if JavaScript is busy. Always use shared values (useSharedValue) instead of React state for gesture-driven animations.
Gesture states: Each gesture transitions through states: UNDETERMINED -> BEGAN -> ACTIVE -> END (or FAILED/CANCELLED). Use onStart (BEGAN), onUpdate (ACTIVE), and onEnd (END) to respond at each phase.
Common mistakes:
GestureHandlerRootView at the app root (gestures silently fail)runOnJShttps://docs.swmansion.com/react-native-gesture-handler/
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job