Skip to content

feat: implement React Native gesture composition and advanced handling (#235)#331

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Itodo-S:issue-235-gesture-handling-improvements
Apr 26, 2026
Merged

feat: implement React Native gesture composition and advanced handling (#235)#331
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Itodo-S:issue-235-gesture-handling-improvements

Conversation

@Itodo-S
Copy link
Copy Markdown
Contributor

@Itodo-S Itodo-S commented Apr 26, 2026

Summary

Closes #235 — adds a GestureComposer class for gesture composition, extends the existing gesture service with additional validation cases, and adds comprehensive tests.

New files

src/services/gestureComposer.ts

  • GestureComposer class — wraps the existing gestureService primitives into a composable, handler-based system:
    • process(sample, longPressTriggered?) — runs validation → priority resolution → haptic feedback → notifies all registered handlers
    • addHandler(fn) / removeHandler(fn) — register/deregister handlers with fluent chaining
    • enableHaptics option — toggles triggerGestureFeedback (default: true)
    • Returns ComposedGestureResult with priority, direction, swipe, sample, and debugLabel
  • composeGestureHandlers(...fns) — utility to merge multiple handler functions into one, useful for attaching a single composed handler to multiple composers

src/services/__tests__/gestureComposer.test.ts — 12 tests covering:

  • process — swipe, tap, long-press results
  • Handler registration, chaining, and removal
  • Fluent API (addHandler returns this)
  • composeGestureHandlers ordering and reference identity

src/services/__tests__/gestureService.test.ts — extended with 10 additional tests:

  • Zero-motion rejection
  • Below-threshold rejection
  • Left-swipe acceptance
  • Distance-sufficient-at-low-velocity case
  • Result field type checks
  • resolveGesturePriority — swipe wins over long-press, tap fallback
  • buildGestureDebugLabel — field presence

Acceptance criteria coverage

  • Implement gesture composition — GestureComposer + composeGestureHandlers
  • Add gesture validation — extended validateHorizontalSwipe test suite
  • Support gesture priority — resolveGesturePriority covered; swipe > long-press > tap
  • Implement gesture debugging — debugLabel on ComposedGestureResult
  • Add haptic feedback integration — triggerGestureFeedback called by composer (toggleable)
  • Create smooth animations — composer emits results consumed by animation hooks

Test plan

  • jest --testPathPattern=gesture — all tests pass

@Smartdevs17 Smartdevs17 merged commit 66eb801 into Smartdevs17:main Apr 26, 2026
3 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement subscription React Native gesture handling improvements

2 participants