Skip to content

fix: Keep Sortable.Touchable tap and long press working on teleported items#602

Merged
MatiPl01 merged 1 commit into
mainfrom
fix/touchable-gestures-cancelled-on-teleport
Jul 9, 2026
Merged

fix: Keep Sortable.Touchable tap and long press working on teleported items#602
MatiPl01 merged 1 commit into
mainfrom
fix/touchable-gestures-cancelled-on-teleport

Conversation

@MatiPl01

@MatiPl01 MatiPl01 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

When the active-item portal teleports an item, its still-mounted source cell is hidden (moved off-screen via left or set to opacity: 0). gesture-handler reads that hidden view as the finger being outside its bounds, and because a Tap/LongPress recognizer defaults shouldCancelWhenOutside to true, it cancels them - so onTap/onLongPress stop firing on a portal-enabled Sortable.Touchable. The Manual drag gesture is unaffected because it defaults the flag to false, which is why dragging kept working while tap and long press did not. It only surfaces once the app is on gesture-handler v3 (its Android touch handling cancels these recognizers on the hidden source where v2 did not), so it is not caught on the iOS simulator with synthetic touches.

The fix sets shouldCancelWhenOutside: false on the tap, double-tap and long-press recognizers in both gesture-handler adapters (v2 and v3), so they survive the hide the same way the drag gesture does. maxDistance still bounds how far the finger may travel, so the recognizers still fail if it moves off the item.

This targets the root cause; the earlier switch of the hide from an off-screen offset to opacity did not help because opacity 0 is cancelled the same way on Android.

Verified on a physical Android device (New Architecture, gesture-handler v3) driven over adb: with the portal enabled, tap and long press now fire on teleported items across repeated controlled presses, and dragging is unchanged. Regression tests added to both adapter test suites.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
react-native-sortables-docs Ignored Ignored Preview Jul 9, 2026 8:02pm

@MatiPl01 MatiPl01 self-assigned this Jul 9, 2026
The touchable's Tap/LongPress recognizers default to shouldCancelWhenOutside,
so when an item is teleported by the active-item portal, the still-mounted
source cell (hidden off-screen or with opacity 0) reads as the finger being
outside and the recognizers are cancelled. onTap/onLongPress therefore stop
firing on a portal-enabled Sortable.Touchable, while the Manual drag gesture
survives because it defaults the flag to false.

Set shouldCancelWhenOutside to false on the tap, double-tap and long-press
recognizers in both the v2 and v3 gesture-handler adapters so they survive the
hide. maxDistance still bounds how far the finger may move.
@MatiPl01 MatiPl01 force-pushed the fix/touchable-gestures-cancelled-on-teleport branch from bd1880f to b4ac674 Compare July 9, 2026 20:02
@MatiPl01 MatiPl01 merged commit 3efb111 into main Jul 9, 2026
11 checks passed
@MatiPl01 MatiPl01 deleted the fix/touchable-gestures-cancelled-on-teleport branch July 9, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant