Skip to content

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

Merged
merged 3 commits into from
May 24, 2025
Merged

Conversation

MatiPl01
Copy link
Owner

@MatiPl01 MatiPl01 commented May 24, 2025

Description

This PR adds more callbacks to the Sortable.Touchable component:

  • onTap: Callback function triggered when the item is tapped
  • onDoubleTap: Callback function triggered when the item is double tapped
  • onLongPress: Callback function triggered when the item is long pressed
  • onTouchesDown: Callback function triggered when touches begin
  • onTouchesUp: Callback function triggered when touches end

Changes showcase

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-05-25.at.01.00.32.mp4

@MatiPl01 MatiPl01 self-assigned this May 24, 2025
Copy link

vercel bot commented May 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
react-native-sortables-docs ⬜️ Ignored (Inspect) Visit Preview May 24, 2025 11:00pm

@MatiPl01 MatiPl01 requested a review from Copilot May 24, 2025 23:02
Copy link
Contributor

@Copilot Copilot AI left a 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: { ... }

@MatiPl01 MatiPl01 marked this pull request as ready for review May 24, 2025 23:03
@MatiPl01 MatiPl01 merged commit c60500f into main May 24, 2025
6 checks passed
@MatiPl01 MatiPl01 deleted the feat/more-touch-events branch May 24, 2025 23:03
MatiPl01 pushed a commit that referenced this pull request May 26, 2025
# [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))
@MatiPl01
Copy link
Owner Author

🎉 This issue has been resolved in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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