fix: Keep Sortable.Touchable tap and long press working on teleported items#602
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
bd1880f to
b4ac674
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the active-item portal teleports an item, its still-mounted source cell is hidden (moved off-screen via
leftor set toopacity: 0). gesture-handler reads that hidden view as the finger being outside its bounds, and because a Tap/LongPress recognizer defaultsshouldCancelWhenOutsidetotrue, it cancels them - soonTap/onLongPressstop firing on a portal-enabledSortable.Touchable. The Manual drag gesture is unaffected because it defaults the flag tofalse, 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: falseon 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.maxDistancestill 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.