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
Simulates one event stream (i.e. event sequence starting with `BEGIN` state and ending
34
35
with one of `END`/`FAIL`/`CANCEL` states), calling appropriate callbacks associated with given gesture handler.
35
36
36
-
### Arguments
37
-
38
-
#### `gestureOrHandler`
39
-
40
-
Represents either:
41
-
42
-
1. Gesture handler component found by Jest queries (e.g. `getByTestId`)
43
-
2. Gesture found by [`getByGestureTestId()`](/docs/guides/testing#getbygesturetestidtestid)
44
-
45
-
#### `eventList`
37
+
-`componentOrGesture` - Either Gesture Handler component found by `Jest` queries (e.g. `getByTestId`) or Gesture found by [`getByGestureTestId()`](#getbygesturetestidtestid)
46
38
47
-
Event data passed to appropriate callback. RNGH fills event list if required
48
-
data is missing using these rules:
39
+
-`eventList` - Event data passed to appropriate callback. RNGH fills event list if required
40
+
data is missing using these rules:
41
+
-`oldState` is filled using state of the previous event. `BEGIN` events use
42
+
`UNDETERMINED` value as previous event.
43
+
- Events after first `ACTIVE` state can omit `state` field.
44
+
- Handler specific data is filled (e.g. `numberOfTouches`, `x` fields) with
45
+
defaults.
46
+
- Missing `BEGIN` and `END` events are added with data copied from first and last
47
+
passed event, respectively.
48
+
- If first event don't have `state` field, the `ACTIVE` state is assumed.
49
49
50
-
1.`oldState` is filled using state of the previous event. `BEGIN` events use
51
-
`UNDETERMINED` value as previous event.
52
-
2. Events after first `ACTIVE` state can omit `state` field.
53
-
3. Handler specific data is filled (e.g. `numberOfTouches`, `x` fields) with
54
-
defaults.
55
-
4. Missing `BEGIN` and `END` events are added with data copied from first and last
56
-
passed event, respectively.
57
-
5. If first event don't have `state` field, the `ACTIVE` state is assumed.
58
-
59
-
Some examples:
50
+
Some `eventList` examples:
60
51
61
52
```jsx
62
53
constoldStateFilled= [
@@ -86,44 +77,46 @@ const implicitBeginAndEnd = [
86
77
constallImplicits= []; // 3 events, one BEGIN, one ACTIVE, one END with defaults.
87
78
```
88
79
89
-
### Example
90
-
91
-
Extracted from RNGH tests, check `Events.test.tsx` for full implementation.
80
+
### getByGestureTestId
92
81
93
82
```tsx
94
-
it('sends events with additional data to handlers', () => {
Returns opaque data type associated with gesture. Gesture is found via `testID` attribute in rendered
115
-
components (see [`testID`](/docs/gestures/use-pan-gesture#testid)).
116
-
117
-
### Arguments
86
+
Returns opaque data type associated with gesture. Gesture is found via [`testID`](/docs/gestures/use-pan-gesture#testid) attribute in rendered
87
+
components.
118
88
119
-
####`testID`
89
+
-`testID` - String identifying gesture.
120
90
121
-
String identifying gesture.
91
+
:::warning
92
+
`testID` must be unique among components rendered in test.
93
+
:::
122
94
123
-
### Notes
95
+
##Example
124
96
125
-
`testID` must be unique among components rendered in test.
97
+
Extracted from RNGH tests, check [`api_v3.test.tsx`](https://github.com/software-mansion/react-native-gesture-handler/blob/main/packages/react-native-gesture-handler/src/__tests__/api_v3.test.tsx) for full implementation.
0 commit comments