MCPcopy
hub / github.com/callstack/react-native-testing-library / buildScrollEvent

Function buildScrollEvent

src/event-builder/scroll.ts:17–36  ·  view source on GitHub ↗
(offset: Point = { y: 0, x: 0 }, options?: ScrollEventOptions)

Source from the content-addressed store, hash-verified

15 * - Android: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 31.619047164916992}, "contentSize": {"height": 1624.761962890625, "width": 411.4285583496094}, "layoutMeasurement": {"height": 785.5238037109375, "width": 411.4285583496094}, "responderIgnoreScroll": true, "target": 139, "velocity": {"x": -1.3633992671966553, "y": -1.3633992671966553}}`
16 */
17export function buildScrollEvent(offset: Point = { y: 0, x: 0 }, options?: ScrollEventOptions) {
18 return {
19 ...baseSyntheticEvent(),
20 nativeEvent: {
21 contentInset: { bottom: 0, left: 0, right: 0, top: 0 },
22 contentOffset: { y: offset.y, x: offset.x },
23 contentSize: {
24 height: options?.contentSize?.height ?? 0,
25 width: options?.contentSize?.width ?? 0,
26 },
27 layoutMeasurement: {
28 height: options?.layoutMeasurement?.height ?? 0,
29 width: options?.layoutMeasurement?.width ?? 0,
30 },
31 responderIgnoreScroll: true,
32 target: 0,
33 velocity: { y: 0, x: 0 },
34 },
35 };
36}

Callers 4

fire-event.tsFile · 0.90
emitDragScrollEventsFunction · 0.90
emitMomentumScrollEventsFunction · 0.90
scroll.test.tsFile · 0.90

Calls 1

baseSyntheticEventFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…