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 13f4c7b
Browse filesBrowse the repository at this point in the historyBrowse files
## Description
Documents the `pressOutAfterAnimation` prop added to `Touchable` and
`Pressable` in this stack.
## Test plan
Read docs 🤓
---------
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
Copy file name to clipboardExpand all lines: packages/docs-gesture-handler/docs/components/pressable.mdx
+16-2Lines changed: 16 additions & 2 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 after [`onPressOut`](#onpressout) when a single tap gesture is detected. 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 [`pressOutAfterAnimation`](#pressoutafteranimation) delays `onPressOut`. 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 before `onPress`when a touch is released (before [`onPress`](#onpress)). Details about the event object can be found in the [PressableEvent](#pressableevent) section below.
71
+
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.
Whether the view should render with an offscreen alpha-compositing buffer when its `opacity` is less than `1`. Defaults to `false`.
203
203
204
+
<Badgesplatforms={['android', 'ios']}>
205
+
### pressOutAfterAnimation [A][I]
206
+
</Badges>
207
+
208
+
```ts
209
+
pressOutAfterAnimation?:boolean;
210
+
```
211
+
212
+
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.
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.
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.
Copy file name to clipboardExpand all lines: packages/docs-gesture-handler/docs/components/touchable.mdx
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -586,6 +586,20 @@ 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.
588
588
589
+
<Badgesplatforms={['android', 'ios']}>
590
+
### pressOutAfterAnimation [A][I]
591
+
</Badges>
592
+
593
+
```ts
594
+
pressOutAfterAnimation?:boolean;
595
+
```
596
+
597
+
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
+
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.
600
+
601
+
By default set to `false`. Has no effect on web, where presses are never deferred.
0 commit comments