[General] Allow to customize the duration of out animation for long press - #4167
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
animationDurationto accept an optionallongPress.outoverride (fallbacks to resolved tap-out). - Propagates
delayLongPressto native/web via a newlongPressDurationprop 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.
m-bert
approved these changes
May 12, 2026
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.
Description
Adds a
longPressproperty to theanimationDurationlogic. WhendelayLongPressis 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