Skip to content

Commit f4e431b

Browse files
committed
chore: tweak docs
1 parent 0555411 commit f4e431b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

website/docs/12.x/docs/api/events/user-event.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ await user.press(element);
5353

5454
This helper simulates a press on any pressable element, e.g. `Pressable`, `TouchableOpacity`, `Text`, `TextInput`, etc. Unlike `fireEvent.press()`, a more straightforward API that will only call the `onPress` prop, this function simulates the entire press interaction in a more realistic way by reproducing the event sequence emitted by React Native runtime. This helper will trigger additional events like `pressIn` and `pressOut`.
5555

56-
## `longPress()` \{#long-press}
56+
This event will take a minimum of 130 ms to run due to the internal React Native logic. Consider using fake timers to speed up test execution for tests involving `press` and `longPress` interactions.
57+
58+
## `longPress()`
5759

5860
```ts
5961
longPress(
@@ -69,7 +71,9 @@ const user = userEvent.setup();
6971
await user.longPress(element);
7072
```
7173

72-
Simulates a long press user interaction. In React Native, the `longPress` event is emitted when the press duration exceeds the long press threshold (by default, 500 ms). In other aspects, this action behaves similarly to regular `press` action, e.g., by emitting `pressIn` and `pressOut` events. The press duration is customizable through the options. This should be useful if you use the `delayLongPress` prop. When using real timers, this will take 500 ms, so it is highly recommended to use that API with fake timers to prevent the test from taking a long time to run.
74+
Simulates a long press user interaction. In React Native, the `longPress` event is emitted when the press duration exceeds the long press threshold (by default, 500 ms). In other aspects, this action behaves similarly to regular `press` action, e.g., by emitting `pressIn` and `pressOut` events. The press duration is customizable through the options. This should be useful if you use the `delayLongPress` prop.
75+
76+
This event will, by default, take 500 ms to run. Due to internal React Native logic, it will take at least 130 ms regardless of the duration option passed. Consider using fake timers to speed up test execution for tests involving `press` and `longPress` interactions.
7377

7478
### Options {#longpress-options}
7579

@@ -107,7 +111,7 @@ This function will add text to the text already present in the text input (as sp
107111
- `skipPress` - if true, `pressIn` and `pressOut` events will not be triggered.
108112
- `submitEditing` - if true, `submitEditing` event will be triggered after typing the text.
109113
110-
### Sequence of events
114+
### Sequence of events {#type-sequence}
111115
112116
The sequence of events depends on the `multiline` prop and the passed options.
113117
@@ -156,7 +160,7 @@ This helper simulates the user clearing the content of a `TextInput` element.
156160
157161
This function supports only host `TextInput` elements. Passing other element types will result in throwing an error.
158162
159-
### Sequence of events
163+
### Sequence of events {#clear-sequence}
160164
161165
Events will not be emitted if the `editable` prop is set to `false`.
162166
@@ -200,7 +204,7 @@ This helper simulates the user pasting given text to a `TextInput` element.
200204
201205
This function supports only host `TextInput` elements. Passing other element types will result in throwing an error.
202206
203-
### Sequence of events
207+
### Sequence of events {#paste-sequence}
204208
205209
Events will not be emitted if the `editable` prop is set to `false`.
206210
@@ -278,7 +282,7 @@ This function will remember where the last scroll ended, so subsequent scroll in
278282
279283
To simulate a `FlatList` (and other controls based on `VirtualizedList`) scrolling, you should pass the `contentSize` and `layoutMeasurement` options, which enable the underlying logic to update the currently visible window.
280284
281-
### Sequence of events
285+
### Sequence of events {#scroll-sequence}
282286
283287
The sequence of events depends on whether the scroll includes an optional momentum scroll component.
284288

0 commit comments

Comments
 (0)