-
Notifications
You must be signed in to change notification settings - Fork 14
feat: Add more touch events to the touchable #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the touch handling in sortable items by replacing the "Pressable" component with a more versatile "Touchable" that now accepts additional gesture callbacks such as onDoubleTap, onLongPress, onTouchesDown, and onTouchesUp. It also updates related examples and routing to reflect these changes.
- Renames and documents the previously “Pressable” component as “Touchable” with added event callbacks.
- Updates the gesture composition logic in the SortableTouchable component to accommodate multiple touch event types.
- Adjusts routes and examples to include new touchable examples while removing an outdated test component.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/react-native-sortables/src/index.ts | Renamed documentation and updated comments to reflect the new “Touchable” API. |
packages/react-native-sortables/src/components/shared/SortableTouchable.tsx | Modified gesture setup to support additional touch events and converted onTap from required to optional. |
example/app/src/examples/navigation/routes.ts | Updated route keys to reflect new examples for touchable components. |
example/app/src/examples/SortableGrid/features/TouchableExample.tsx | Introduced a new example showcasing the added touch event callbacks. |
example/app/src/examples/SortableFlex/features/TouchableExample.tsx | Added a Flex-based example that demonstrates the new touchable behavior. |
Other files | Adjustments in CHANGELOG and export files to include the new touchable examples and removal of an outdated test file. |
Comments suppressed due to low confidence (2)
packages/react-native-sortables/src/components/shared/SortableTouchable.tsx:45
- Verify that switching the tap gesture callback from onEnd to onStart is intentional and provides the desired user feedback timing.
if (onTap) { gestures.push(decorate(Gesture.Tap()).onStart(onTap)); }
example/app/src/examples/navigation/routes.ts:53
- [nitpick] The new route key 'Touchable' may be ambiguous; consider renaming it to 'Touchable Example' or a more descriptive identifier to clearly reflect its functionality.
CallbacksExample: { ... } -> Callbacks: { ... } and DebugExample: { ... } -> Touchable: { ... }
# [1.7.0](v1.6.0...v1.7.0) (2025-05-26) ### Bug Fixes * Invalid call to gesture manager when item is no longer available ([#385](#385)) ([5e5e1ca](5e5e1ca)) * Invalid custom handle measurement ([#384](#384)) ([ad03d2b](ad03d2b)), closes [#377](#377) * onPress not fired when activation delay is low ([#377](#377)) ([07065b5](07065b5)), closes [#375](#375) * Order change callback invalid keyToIndex and shadow color interpolation ([#380](#380)) ([c0b3c03](c0b3c03)) * Stop passing excessive data to the item context ([#383](#383)) ([0b466ac](0b466ac)) ### Features * Active item dropped callback, more props in drag start callback ([#381](#381)) ([ef6e6cd](ef6e6cd)) * Add keyToIndex and indexToKey to the item context ([#379](#379)) ([9166043](9166043)) * Add more params to the item drop callback ([#382](#382)) ([36fe591](36fe591)) * Add more touch events to the touchable ([#378](#378)) ([c60500f](c60500f))
🎉 This issue has been resolved in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR adds more callbacks to the
Sortable.Touchable
component:onTap
: Callback function triggered when the item is tappedonDoubleTap
: Callback function triggered when the item is double tappedonLongPress
: Callback function triggered when the item is long pressedonTouchesDown
: Callback function triggered when touches beginonTouchesUp
: Callback function triggered when touches endChanges showcase
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-05-25.at.01.00.32.mp4