You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bfae4a2
Browse filesBrowse the repository at this point in the historyBrowse files
Rename pressOutAfterAnimation to immediatePressOut (#4594)
## Description
The prop that holds `onPressOut` for a platform-deferred quick tap is
renamed to `immediatePressOut` and its meaning inverted, so the hold is
the default and `true` opts out of it.
Defaults stay behaviour-compatible with RN:
- `Pressable`: `false`, `onPressOut` is held so `pressed` lasts at least
130 ms (RN `minPressDuration`).
- `Touchable`: `true`, no hold (RN
`TouchableOpacity`/`TouchableHighlight` pass `minPressDuration: 0`).
- native button / codegen: `true`, so a button rendered without the prop
keeps its current timing.
Also includes a docs touch-up: the `Available from` badge next to a
heading is restyled as an outline chip aligned to the right, so it no
longer reads as a third platform pill, and both pages get
`version="3.4.0"` on the new prop.
## Test plan
Read docs 🤓
Copy file name to clipboardExpand all lines: packages/docs-gesture-handler/docs/components/pressable.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ Either view styles or a function that receives a boolean reflecting whether the
52
52
onPress?:null| ((event:PressableEvent) =>void);
53
53
```
54
54
55
-
Called when a single tap gesture is detected. It follows [`onPressOut`](#onpressout), unless [`pressOutAfterAnimation`](#pressoutafteranimation) delays `onPressOut`. Details about the event object can be found in the [PressableEvent](#pressableevent) section below.
55
+
Called when a single tap gesture is detected. It follows [`onPressOut`](#onpressout), unless [`immediatePressOut`](#immediatepressout) is off and the platform deferred a quick tap. Details about the event object can be found in the [PressableEvent](#pressableevent) section below.
56
56
57
57
### onPressIn
58
58
@@ -68,7 +68,7 @@ Called before `onPress` when a touch is engaged. Details about the event object
Called when a touch is released. When[`pressOutAfterAnimation`](#pressoutafteranimation) is set to `true`, a quick tap the platform deferred calls it after [`onPress`](#onpress). Details about the event object can be found in the [PressableEvent](#pressableevent) section below.
71
+
Called when a touch is released. Unless[`immediatePressOut`](#immediatepressout) is set to `true`, a quick tap the platform deferred calls it after [`onPress`](#onpress). Details about the event object can be found in the [PressableEvent](#pressableevent) section below.
In some cases the platform defers the press, so a quick tap calls `onPressIn` and `onPressOut` almost at the same time and the `pressed` state never shows up.
212
+
In some cases the platform defers the press, so a quick tap would call `onPressIn` and `onPressOut` almost at the same time and the `pressed` state would never show up. By default, `onPressOut` for such a tap is held back so that `pressed` lasts at least 130 ms, matching React Native's `Pressable`. `onPress` is never delayed, so on such a tap it is called before `onPressOut`. Longer presses and presses that were not deferred by the platform keep the usual order.
213
213
214
-
When set to `true`, `onPressOut`for such a tap is held back so that `pressed` lasts at least 130 ms, matching React Native's `Pressable`. `onPress` is never delayed, so on such a tap it is called before `onPressOut`. Longer presses and presses that were not deferred by the platform keep the usual order.
214
+
When set to `true`, `onPressOut` is called as soon as the press ends, even for such a tap.
215
215
216
-
By default set to `true`. Has no effect on web, where presses are never deferred, or when `simultaneousWith`, `requireToFail` or `block` is passed.
216
+
By default set to `false`. Has no effect on web, where presses are never deferred, or when `simultaneousWith`, `requireToFail` or `block` is passed.
Copy file name to clipboardExpand all lines: packages/docs-gesture-handler/docs/components/touchable.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -586,19 +586,19 @@ cancelOnLeave?: boolean;
586
586
587
587
Whether the touch should be canceled when the pointer leaves the component. By default set to `true`. On web this prop doesn't have any effect and behaves as if `true` was set.
In some cases the platform defers the press, so a quick tap calls `onPressIn` and `onPressOut` almost at the same time and feedback driven from these callbacks never shows up.
598
598
599
-
When set to `true`, `onPressOut` for such a tap is held back until the press-in animation (see [`animationDuration`](#animationduration)) finishes. `onPress` is never delayed, so on such a tap it is called before `onPressOut`. Longer presses and presses that were not deferred by the platform keep the usual order.
599
+
When set to `false`, `onPressOut` for such a tap is held back until the press-in animation (see [`animationDuration`](#animationduration)) finishes. `onPress` is never delayed, so on such a tap it is called before `onPressOut`. Longer presses and presses that were not deferred by the platform keep the usual order.
600
600
601
-
By default set to `false`. Has no effect on web, where presses are never deferred.
601
+
By default set to `true`. Has no effect on web, where presses are never deferred.
Copy file name to clipboardExpand all lines: packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ class RNGestureHandlerButtonViewManager :
79
79
view.managedHandlerTestID =null
80
80
view.managedHandlerHitSlop =null
81
81
view.moduleId =null
82
-
view.pressOutAfterAnimation=false
82
+
view.immediatePressOut=true
83
83
view.resetHoverState()
84
84
// Has to come last — every setter above flags the view as needing a managed handler update.
85
85
view.managedHandlerNeedsUpdate =false
@@ -358,9 +358,9 @@ class RNGestureHandlerButtonViewManager :
0 commit comments