Skip to main content

mobile-gesture-handler

Handles touch gestures including swipe, pinch, long press, and drag. Provides unified gesture recognition across iOS and Android.

소스 정보

저장소
Fadil369/Solutions
최근 소스 활동
2026년 4월 9일 00:36
감지된 SKILL.md 언어
영어
스타
1
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
Mobile Gesture Handler
version
1.0.0
description
Handles touch gestures including swipe, pinch, long press, and drag. Provides unified gesture recognition across iOS and Android.
author
workspace
activated
false
# Mobile Gesture Handler Handles touch gestures including swipe, pinch, long press, and drag. Provides unified gesture recognition across iOS and Android. ## Decision Framework ### When to Apply Use when: Touch interactions, swipe navigation, drag-and-drop on mobile, pinch-to-zoom, mobile-specific UX ### When NOT to Apply Don't use when: Desktop-only applications, simple tap interactions ## Anti-Patterns ### 1. Tiny Touch Targets ```css /* BAD: 20px target */ .icon-button { width: 20px; height: 20px; } /* GOOD: 44px minimum per Apple/Google guidelines */ .icon-button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; } ``` ### 2. No Gesture Feedback Always provide visual feedback during gestures (swipe reveals, drag handles, etc.). ## Trigger Phrases - "Touch gestures" - "Swipe navigation" - "Pinch to zoom" - "Long press" - "Mobile interactions" ## Patterns ### Swipe Detector ```javascript function useSwipe(onSwipeLeft, onSwipeRight, threshold = 50) { const touchStart = useRef(null); const onTouchStart = (e) => { touchStart.current = e.touches[0].clientX; }; const onTouchEnd = (e) => { if (!touchStart.current) return; const diff = touchStart.current - e.changedTouches[0].clientX; if (Math.abs(diff) > threshold) { diff > 0 ? onSwipeLeft?.() : onSwipeRight?.(); } touchStart.current = null; }; return { onTouchStart, onTouchEnd }; } ``` ### Long Press ```javascript function useLongPress(callback, delay = 500) { const timerRef = useRef(null); const start = () => { timerRef.current = setTimeout(callback, delay); }; const cancel = () => clearTimeout(timerRef.current); return { onTouchStart: start, onTouchEnd: cancel, onTouchMove: cancel, onMouseDown: start, onMouseUp: cancel, onMouseLeave: cancel, }; } ``` ## Integration - Works with: accessibility-pattern-library, component-lifecycle-manager
GitHub에서 보기