🎨 Palette: Add haptic feedback to flight card swipe#60
🎨 Palette: Add haptic feedback to flight card swipe#60TargetMisser wants to merge 2 commits intomainfrom
Conversation
- Integrated expo-haptics in SwipeableFlightCard - Added light haptic impact when swipe threshold is reached - Managed gesture state with useRef to ensure single trigger per crossing - Documented pattern in .Jules/palette.md Co-authored-by: TargetMisser <52361977+TargetMisser@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds haptic feedback during the flight card swipe gesture to provide tactile confirmation when the pin/unpin threshold is crossed.
Changes:
- Integrates
expo-hapticsintoSwipeableFlightCardto trigger a light impact when the swipe threshold is reached. - Tracks a per-gesture “already triggered” flag and resets it on release/termination to avoid repeated firing within a single continuous swipe.
- Adds a
.Jules/palette.mdnote documenting the approach.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/screens/FlightScreen.tsx |
Triggers a one-time haptic when the swipe crosses the pinning threshold and resets the trigger on gesture end/cancel. |
.Jules/palette.md |
Adds an internal note describing the haptics pattern used for continuous gestures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| onPanResponderMove: (_, g) => { | ||
| if (g.dx < 0) translateX.setValue(g.dx); | ||
| if (g.dx <= -SWIPE_THRESHOLD && !hasTriggeredHaptic.current) { | ||
| Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); |
There was a problem hiding this comment.
Haptics.impactAsync(...) returns a Promise, but it’s being fired-and-forgotten inside onPanResponderMove. If the call rejects (e.g., unsupported platform/runtime), this can surface as an unhandled promise rejection. Consider explicitly swallowing/handling errors (e.g., attach .catch(() => {}) or wrap in a safe helper) so gesture handling can’t trigger runtime warnings/crashes.
| Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); | |
| Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => {}); |
| ## 2026-04-08 - Haptic feedback for continuous gestures | ||
| **Learning:** When implementing haptic feedback with 'expo-haptics' in continuous gestures (like 'PanResponder'), use a 'useRef' toggle (e.g., 'hasTriggeredHaptic') to ensure the feedback triggers only once when a threshold is crossed. | ||
| **Action:** Always include a reset of the haptic trigger ref in both completion ('onPanResponderRelease') and cancellation ('onPanResponderTerminate') handlers. |
There was a problem hiding this comment.
This PR adds a new .Jules/palette.md note file that isn’t mentioned in the PR description and looks like automation/internal “learning” documentation. If this isn’t intended to ship with the app, consider removing it from the PR (or adding .Jules/ to .gitignore / moving this guidance into an appropriate docs location).
- Implemented light haptic impact when swipe threshold is reached in SwipeableFlightCard. - Managed gesture state with useRef to ensure single trigger per crossing. - Documented pattern in .Jules/palette.md. - Updated package-lock.json to resolve CI installation errors. Co-authored-by: TargetMisser <52361977+TargetMisser@users.noreply.github.com>
Added haptic feedback to the flight card swipe action to provide tactile confirmation when the pinning threshold is reached. This improvement makes the interaction feel more deliberate and responsive.
PR created automatically by Jules for task 11524619721532182718 started by @TargetMisser