Skip to content

[General] Allow to customize the duration of out animation for long press - #4167

Merged
j-piasecki merged 2 commits into
mainfrom
@jpiasecki/touchable-long-press-out
May 13, 2026
Merged

[General] Allow to customize the duration of out animation for long press#4167
j-piasecki merged 2 commits into
mainfrom
@jpiasecki/touchable-long-press-out

Conversation

@j-piasecki

Copy link
Copy Markdown
Member

Description

Adds a longPress property to the animationDuration logic. When delayLongPress is set, the value is propagated to the native side, so it can recognize longpress and trigger the relevant animation path.

Test plan

Updated the existing example

Copilot AI review requested due to automatic review settings May 12, 2026 05:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds long-press–aware press-out animation timing to the v3 Touchable and to the underlying GestureHandlerButton implementations (native + web), enabling a different “release” duration once a press is held past delayLongPress.

Changes:

  • Extends animationDuration to accept an optional longPress.out override (fallbacks to resolved tap-out).
  • Propagates delayLongPress to native/web via a new longPressDuration prop so the button can choose the long-press release path.
  • Implements long-press release timing on iOS, Android, and web; updates docs and the example app.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/react-native-gesture-handler/src/v3/components/Touchable/TouchableProps.ts Adds animationDuration.longPress typing and documentation.
packages/react-native-gesture-handler/src/v3/components/Touchable/Touchable.tsx Resolves long-press out duration and forwards longPressDuration to the button.
packages/react-native-gesture-handler/src/specs/RNGestureHandlerButtonNativeComponent.ts Adds native props longPressDuration + longPressAnimationOutDuration to codegen spec.
packages/react-native-gesture-handler/src/components/GestureHandlerButton.web.tsx Implements long-press-aware press-out timing on web.
packages/react-native-gesture-handler/src/components/GestureHandlerButton.tsx Documents new long-press timing props on the button API.
packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm Wires new props from Fabric component props into the native button view.
packages/react-native-gesture-handler/apple/RNGestureHandlerButton.mm Adds long-press branch in press-out animation logic + long-press out duration fallback getter.
packages/react-native-gesture-handler/apple/RNGestureHandlerButton.h Declares new long-press timing properties.
packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt Adds React props + long-press-aware press-out animation branch on Android.
packages/docs-gesture-handler/docs/components/touchable.mdx Documents animationDuration.longPress.out and provides usage example.
apps/common-app/src/new_api/components/touchable/index.tsx Updates example to demonstrate long-press release timing override.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@j-piasecki
j-piasecki requested a review from m-bert May 12, 2026 06:07
@j-piasecki
j-piasecki merged commit 9ce3db3 into main May 13, 2026
12 checks passed
@j-piasecki
j-piasecki deleted the @jpiasecki/touchable-long-press-out branch May 13, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants