@testing-library/react-native 14.0.0-beta.0 → 14.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -33
- package/build/event-builder/base.js.map +1 -0
- package/build/event-builder/common.d.ts +152 -0
- package/build/event-builder/common.js +80 -0
- package/build/event-builder/common.js.map +1 -0
- package/build/event-builder/index.d.ts +3 -0
- package/build/event-builder/index.js +39 -0
- package/build/event-builder/index.js.map +1 -0
- package/build/event-builder/scroll.d.ts +56 -0
- package/build/event-builder/scroll.js +51 -0
- package/build/event-builder/scroll.js.map +1 -0
- package/build/event-builder/text.d.ts +162 -0
- package/build/event-builder/text.js +113 -0
- package/build/event-builder/text.js.map +1 -0
- package/build/fire-event.d.ts +6 -5
- package/build/fire-event.js +47 -23
- package/build/fire-event.js.map +1 -1
- package/build/helpers/accessibility.d.ts +18 -15
- package/build/helpers/accessibility.js +64 -47
- package/build/helpers/accessibility.js.map +1 -1
- package/build/helpers/component-tree.d.ts +9 -9
- package/build/helpers/component-tree.js +17 -17
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/find-all.d.ts +2 -2
- package/build/helpers/find-all.js +1 -1
- package/build/helpers/find-all.js.map +1 -1
- package/build/helpers/format-element.d.ts +5 -5
- package/build/helpers/format-element.js +9 -9
- package/build/helpers/format-element.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +13 -13
- package/build/helpers/host-component-names.js +18 -18
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-state.d.ts +2 -2
- package/build/helpers/matchers/match-accessibility-state.js +6 -6
- package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
- package/build/helpers/matchers/match-accessibility-value.js +2 -2
- package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
- package/build/helpers/matchers/match-label-text.d.ts +2 -2
- package/build/helpers/matchers/match-label-text.js +2 -2
- package/build/helpers/matchers/match-label-text.js.map +1 -1
- package/build/helpers/matchers/match-text-content.d.ts +5 -5
- package/build/helpers/matchers/match-text-content.js +5 -5
- package/build/helpers/matchers/match-text-content.js.map +1 -1
- package/build/helpers/pointer-events.d.ts +2 -2
- package/build/helpers/pointer-events.js +4 -4
- package/build/helpers/pointer-events.js.map +1 -1
- package/build/helpers/text-content.d.ts +2 -2
- package/build/helpers/text-content.js +5 -5
- package/build/helpers/text-content.js.map +1 -1
- package/build/helpers/text-input.d.ts +3 -3
- package/build/helpers/text-input.js +6 -6
- package/build/helpers/text-input.js.map +1 -1
- package/build/matchers/to-be-busy.d.ts +2 -2
- package/build/matchers/to-be-busy.js +5 -5
- package/build/matchers/to-be-busy.js.map +1 -1
- package/build/matchers/to-be-checked.d.ts +2 -2
- package/build/matchers/to-be-checked.js +9 -9
- package/build/matchers/to-be-checked.js.map +1 -1
- package/build/matchers/to-be-disabled.d.ts +3 -3
- package/build/matchers/to-be-disabled.js +10 -10
- package/build/matchers/to-be-disabled.js.map +1 -1
- package/build/matchers/to-be-empty-element.d.ts +2 -2
- package/build/matchers/to-be-empty-element.js +4 -4
- package/build/matchers/to-be-empty-element.js.map +1 -1
- package/build/matchers/to-be-expanded.d.ts +3 -3
- package/build/matchers/to-be-expanded.js +10 -10
- package/build/matchers/to-be-expanded.js.map +1 -1
- package/build/matchers/to-be-on-the-screen.d.ts +2 -2
- package/build/matchers/to-be-on-the-screen.js +7 -7
- package/build/matchers/to-be-on-the-screen.js.map +1 -1
- package/build/matchers/to-be-partially-checked.d.ts +2 -2
- package/build/matchers/to-be-partially-checked.js +8 -8
- package/build/matchers/to-be-partially-checked.js.map +1 -1
- package/build/matchers/to-be-selected.d.ts +2 -2
- package/build/matchers/to-be-selected.js +4 -4
- package/build/matchers/to-be-selected.js.map +1 -1
- package/build/matchers/to-be-visible.d.ts +2 -2
- package/build/matchers/to-be-visible.js +12 -12
- package/build/matchers/to-be-visible.js.map +1 -1
- package/build/matchers/to-contain-element.d.ts +2 -2
- package/build/matchers/to-contain-element.js +6 -6
- package/build/matchers/to-contain-element.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.d.ts +2 -2
- package/build/matchers/to-have-accessibility-value.js +6 -6
- package/build/matchers/to-have-accessibility-value.js.map +1 -1
- package/build/matchers/to-have-accessible-name.d.ts +2 -2
- package/build/matchers/to-have-accessible-name.js +5 -10
- package/build/matchers/to-have-accessible-name.js.map +1 -1
- package/build/matchers/to-have-display-value.d.ts +2 -2
- package/build/matchers/to-have-display-value.js +6 -6
- package/build/matchers/to-have-display-value.js.map +1 -1
- package/build/matchers/to-have-prop.d.ts +2 -2
- package/build/matchers/to-have-prop.js +6 -6
- package/build/matchers/to-have-prop.js.map +1 -1
- package/build/matchers/to-have-style.d.ts +2 -2
- package/build/matchers/to-have-style.js +5 -5
- package/build/matchers/to-have-style.js.map +1 -1
- package/build/matchers/to-have-text-content.d.ts +2 -2
- package/build/matchers/to-have-text-content.js +4 -4
- package/build/matchers/to-have-text-content.js.map +1 -1
- package/build/matchers/types.d.ts +20 -20
- package/build/matchers/types.js.map +1 -1
- package/build/matchers/utils.d.ts +4 -4
- package/build/matchers/utils.js +6 -6
- package/build/matchers/utils.js.map +1 -1
- package/build/native-state.d.ts +3 -3
- package/build/native-state.js +2 -2
- package/build/native-state.js.map +1 -1
- package/build/queries/display-value.d.ts +2 -2
- package/build/queries/display-value.js +12 -12
- package/build/queries/display-value.js.map +1 -1
- package/build/queries/hint-text.d.ts +2 -2
- package/build/queries/hint-text.js +11 -11
- package/build/queries/hint-text.js.map +1 -1
- package/build/queries/label-text.d.ts +2 -2
- package/build/queries/label-text.js +9 -9
- package/build/queries/label-text.js.map +1 -1
- package/build/queries/make-queries.d.ts +8 -8
- package/build/queries/make-queries.js +11 -11
- package/build/queries/make-queries.js.map +1 -1
- package/build/queries/placeholder-text.d.ts +2 -2
- package/build/queries/placeholder-text.js +11 -11
- package/build/queries/placeholder-text.js.map +1 -1
- package/build/queries/role.d.ts +2 -2
- package/build/queries/role.js +17 -27
- package/build/queries/role.js.map +1 -1
- package/build/queries/test-id.d.ts +2 -2
- package/build/queries/test-id.js +11 -11
- package/build/queries/test-id.js.map +1 -1
- package/build/queries/text.d.ts +2 -2
- package/build/queries/text.js +9 -9
- package/build/queries/text.js.map +1 -1
- package/build/render.d.ts +3 -4
- package/build/render.js +17 -3
- package/build/render.js.map +1 -1
- package/build/screen.js.map +1 -1
- package/build/test-utils/react-version-gates.d.ts +1 -0
- package/build/test-utils/react-version-gates.js +28 -0
- package/build/test-utils/react-version-gates.js.map +1 -0
- package/build/types.d.ts +7 -0
- package/build/types.js.map +1 -1
- package/build/user-event/clear.d.ts +2 -2
- package/build/user-event/clear.js +13 -13
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/index.d.ts +7 -7
- package/build/user-event/index.js +6 -6
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/paste.d.ts +2 -2
- package/build/user-event/paste.js +18 -18
- package/build/user-event/paste.js.map +1 -1
- package/build/user-event/press/press.d.ts +3 -3
- package/build/user-event/press/press.js +35 -35
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/scroll/scroll-to.d.ts +2 -2
- package/build/user-event/scroll/scroll-to.js +20 -20
- package/build/user-event/scroll/scroll-to.js.map +1 -1
- package/build/user-event/setup/setup.d.ts +11 -11
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.d.ts +3 -3
- package/build/user-event/type/type.js +27 -28
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/dispatch-event.d.ts +3 -3
- package/build/user-event/utils/dispatch-event.js +4 -4
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/user-event/utils/index.d.ts +0 -1
- package/build/user-event/utils/index.js +0 -11
- package/build/user-event/utils/index.js.map +1 -1
- package/build/within.d.ts +3 -3
- package/build/within.js +10 -10
- package/build/within.js.map +1 -1
- package/package.json +38 -27
- package/build/tsconfig.release.tsbuildinfo +0 -1
- package/build/user-event/event-builder/base.js.map +0 -1
- package/build/user-event/event-builder/common.d.ts +0 -155
- package/build/user-event/event-builder/common.js +0 -77
- package/build/user-event/event-builder/common.js.map +0 -1
- package/build/user-event/event-builder/index.d.ts +0 -318
- package/build/user-event/event-builder/index.js +0 -15
- package/build/user-event/event-builder/index.js.map +0 -1
- package/build/user-event/event-builder/scroll-view.d.ts +0 -58
- package/build/user-event/event-builder/scroll-view.js +0 -53
- package/build/user-event/event-builder/scroll-view.js.map +0 -1
- package/build/user-event/event-builder/text-input.d.ts +0 -165
- package/build/user-event/event-builder/text-input.js +0 -105
- package/build/user-event/event-builder/text-input.js.map +0 -1
- package/build/user-event/utils/text-range.d.ts +0 -4
- package/build/user-event/utils/text-range.js +0 -6
- package/build/user-event/utils/text-range.js.map +0 -1
- /package/build/{user-event/event-builder → event-builder}/base.d.ts +0 -0
- /package/build/{user-event/event-builder → event-builder}/base.js +0 -0
package/README.md
CHANGED
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
[![MIT License][license-badge]][license]
|
|
13
13
|
[![Sponsored by Callstack][callstack-badge]][callstack]
|
|
14
14
|
|
|
15
|
-
>
|
|
15
|
+
> [!WARNING]
|
|
16
|
+
> **Beta Version:** This version (v14) is currently in beta. APIs and behavior may change before the stable release. Please report any issues you encounter.
|
|
17
|
+
>
|
|
18
|
+
> For stable version (v13) see [README-v13.md](./README-v13.md).
|
|
16
19
|
|
|
17
20
|
## The problem
|
|
18
21
|
|
|
19
|
-
You want to write maintainable tests for your React Native components.
|
|
22
|
+
You want to write maintainable tests for your React Native components. Your tests should avoid implementation details and focus on giving you confidence. They should remain maintainable so refactors (changes to implementation but not functionality) don't break your tests and slow you and your team down.
|
|
20
23
|
|
|
21
24
|
## This solution
|
|
22
25
|
|
|
23
|
-
The React Native Testing Library (RNTL)
|
|
26
|
+
The React Native Testing Library (RNTL) tests React Native components. It simulates the React Native runtime on top of [Test Renderer](https://github.com/mdjastrzebski/test-renderer) and encourages better testing practices. Its primary guiding principle is:
|
|
24
27
|
|
|
25
28
|
> The more your tests resemble the way your software is used, the more confidence they can give you.
|
|
26
29
|
|
|
@@ -31,20 +34,12 @@ This project is inspired by [React Testing Library](https://github.com/testing-l
|
|
|
31
34
|
Open a Terminal in your project's folder and run:
|
|
32
35
|
|
|
33
36
|
```sh
|
|
34
|
-
# Yarn install:
|
|
35
|
-
yarn add --dev @testing-library/react-native@alpha
|
|
36
|
-
|
|
37
|
-
# NPM install
|
|
38
37
|
npm install --save-dev @testing-library/react-native@alpha
|
|
39
38
|
```
|
|
40
39
|
|
|
41
40
|
This library has a `peerDependencies` listing for [Test Renderer](https://github.com/mdjastrzebski/test-renderer). Make sure to install it as a dev dependency:
|
|
42
41
|
|
|
43
42
|
```sh
|
|
44
|
-
# Yarn install:
|
|
45
|
-
yarn add --dev test-renderer
|
|
46
|
-
|
|
47
|
-
# NPM install
|
|
48
43
|
npm install --save-dev test-renderer
|
|
49
44
|
```
|
|
50
45
|
|
|
@@ -58,10 +53,6 @@ You can use the built-in Jest matchers automatically by having any import from `
|
|
|
58
53
|
import { render, screen, userEvent } from '@testing-library/react-native';
|
|
59
54
|
import { QuestionsBoard } from '../QuestionsBoard';
|
|
60
55
|
|
|
61
|
-
// It is recommended to use userEvent with fake timers
|
|
62
|
-
// Some events involve duration so your tests may take a long time to run.
|
|
63
|
-
jest.useFakeTimers();
|
|
64
|
-
|
|
65
56
|
test('form submits two answers', async () => {
|
|
66
57
|
const questions = ['q1', 'q2'];
|
|
67
58
|
const onSubmit = jest.fn();
|
|
@@ -91,34 +82,32 @@ You can find the source of `QuestionsBoard` component and this example [here](ht
|
|
|
91
82
|
|
|
92
83
|
React Native Testing Library consists of following APIs:
|
|
93
84
|
|
|
94
|
-
- [`render` function](https://callstack.
|
|
95
|
-
- [`screen` object](https://callstack.
|
|
96
|
-
- [Queries](https://callstack.
|
|
97
|
-
- Lifecycle methods: [`rerender`](https://callstack.
|
|
98
|
-
- Helpers: [`debug`](https://callstack.
|
|
99
|
-
- [Jest matchers](https://callstack.
|
|
100
|
-
- [User Event](https://callstack.
|
|
101
|
-
- [Fire Event](https://callstack.
|
|
102
|
-
- [`renderHook` function](https://callstack.
|
|
85
|
+
- [`render` function](https://oss.callstack.com/react-native-testing-library/docs/api/render) - render your UI components for testing purposes
|
|
86
|
+
- [`screen` object](https://oss.callstack.com/react-native-testing-library/docs/api/screen) - access rendered UI:
|
|
87
|
+
- [Queries](https://oss.callstack.com/react-native-testing-library/docs/api/queries) - find rendered components by various predicates: role, text, test ids, etc
|
|
88
|
+
- Lifecycle methods: [`rerender`](https://oss.callstack.com/react-native-testing-library/docs/api/screen#rerender), [`unmount`](https://oss.callstack.com/react-native-testing-library/docs/api/screen#unmount)
|
|
89
|
+
- Helpers: [`debug`](https://oss.callstack.com/react-native-testing-library/docs/api/screen#debug), [`toJSON`](https://oss.callstack.com/react-native-testing-library/docs/api/screen#tojson), [`root`](https://oss.callstack.com/react-native-testing-library/docs/api/screen#root), [`container`](https://oss.callstack.com/react-native-testing-library/docs/api/screen#container)
|
|
90
|
+
- [Jest matchers](https://oss.callstack.com/react-native-testing-library/docs/api/jest-matchers) - validate assumptions about your UI
|
|
91
|
+
- [User Event](https://oss.callstack.com/react-native-testing-library/docs/api/events/user-event) - simulate common user interactions like [`press`](https://oss.callstack.com/react-native-testing-library/docs/api/events/user-event#press) or [`type`](https://oss.callstack.com/react-native-testing-library/docs/api/events/user-event#type)
|
|
92
|
+
- [Fire Event](https://oss.callstack.com/react-native-testing-library/docs/api/events/fire-event) - simulate any component event
|
|
93
|
+
- [`renderHook` function](https://oss.callstack.com/react-native-testing-library/docs/api/misc/render-hook) - render hooks for testing purposes
|
|
103
94
|
- Miscellaneous APIs:
|
|
104
|
-
- [Async utils](https://callstack.
|
|
105
|
-
- [Configuration](https://callstack.
|
|
106
|
-
- [Accessibility](https://callstack.
|
|
107
|
-
- [Other](https://callstack.
|
|
95
|
+
- [Async utils](https://oss.callstack.com/react-native-testing-library/docs/api/misc/async): `findBy*` queries, `waitFor`, `waitForElementToBeRemoved`
|
|
96
|
+
- [Configuration](https://oss.callstack.com/react-native-testing-library/docs/api/misc/config): `configure`, `resetToDefaults`
|
|
97
|
+
- [Accessibility](https://oss.callstack.com/react-native-testing-library/docs/api/misc/accessibility): `isHiddenFromAccessibility`
|
|
98
|
+
- [Other](https://oss.callstack.com/react-native-testing-library/docs/api/misc/other): `within`, `act`, `cleanup`
|
|
108
99
|
|
|
109
100
|
## Migration Guides
|
|
110
101
|
|
|
111
|
-
- **[Migration to 14.0](https://callstack.
|
|
112
|
-
- [Migration to 13.0](https://callstack.github.io/react-native-testing-library/docs/migration/v13)
|
|
113
|
-
- [Migration to built-in Jest Matchers](https://callstack.github.io/react-native-testing-library/docs/migration/jest-matchers)
|
|
102
|
+
- **[Migration to 14.0](https://oss.callstack.com/react-native-testing-library/docs/migration/v14)** - Drops React 18, async APIs by default
|
|
114
103
|
|
|
115
104
|
## Troubleshooting
|
|
116
105
|
|
|
117
|
-
- [Troubleshooting guide](https://callstack.
|
|
106
|
+
- [Troubleshooting guide](https://oss.callstack.com/react-native-testing-library/docs/guides/troubleshooting)
|
|
118
107
|
|
|
119
108
|
## Community Resources
|
|
120
109
|
|
|
121
|
-
Check out our list of [Community Resources about RNTL](https://callstack.
|
|
110
|
+
Check out our list of [Community Resources about RNTL](https://oss.callstack.com/react-native-testing-library/docs/guides/community-resources).
|
|
122
111
|
|
|
123
112
|
## Made with ❤️ at Callstack
|
|
124
113
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","names":["baseSyntheticEvent","currentTarget","target","preventDefault","isDefaultPrevented","stopPropagation","isPropagationStopped","persist","isPersistent","timeStamp"],"sources":["../../src/event-builder/base.ts"],"sourcesContent":["import type { BaseSyntheticEvent } from 'react';\n\n/** Builds base syntentic event stub, with prop values as inspected in RN runtime. */\ntype BaseEvent = Partial<BaseSyntheticEvent<object, unknown, unknown>> & {\n // `isPersistent` is not a standard prop, but it's used in RN runtime. See: https://react.dev/reference/react-dom/components/common#react-event-object-methods\n isPersistent: () => boolean;\n};\n\nexport function baseSyntheticEvent(): BaseEvent {\n return {\n currentTarget: {},\n target: {},\n preventDefault: () => {},\n isDefaultPrevented: () => false,\n stopPropagation: () => {},\n isPropagationStopped: () => false,\n persist: () => {},\n isPersistent: () => false,\n timeStamp: 0,\n };\n}\n"],"mappings":";;;;;;AAEA;;AAMO,SAASA,kBAAkBA,CAAA,EAAc;EAC9C,OAAO;IACLC,aAAa,EAAE,CAAC,CAAC;IACjBC,MAAM,EAAE,CAAC,CAAC;IACVC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;IACxBC,kBAAkB,EAAEA,CAAA,KAAM,KAAK;IAC/BC,eAAe,EAAEA,CAAA,KAAM,CAAC,CAAC;IACzBC,oBAAoB,EAAEA,CAAA,KAAM,KAAK;IACjCC,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;IACjBC,YAAY,EAAEA,CAAA,KAAM,KAAK;IACzBC,SAAS,EAAE;EACb,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental values:
|
|
3
|
+
* - iOS: `{"changedTouches": [[Circular]], "identifier": 1, "locationX": 253, "locationY": 30.333328247070312, "pageX": 273, "pageY": 141.3333282470703, "target": 75, "timestamp": 875928682.0450834, "touches": [[Circular]]}`
|
|
4
|
+
* - Android: `{"changedTouches": [[Circular]], "identifier": 0, "locationX": 160, "locationY": 40.3636360168457, "pageX": 180, "pageY": 140.36363220214844, "target": 53, "targetSurface": -1, "timestamp": 10290805, "touches": [[Circular]]}`
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildTouchEvent(): {
|
|
7
|
+
nativeEvent: {
|
|
8
|
+
changedTouches: unknown[];
|
|
9
|
+
identifier: number;
|
|
10
|
+
locationX: number;
|
|
11
|
+
locationY: number;
|
|
12
|
+
pageX: number;
|
|
13
|
+
pageY: number;
|
|
14
|
+
target: number;
|
|
15
|
+
timestamp: number;
|
|
16
|
+
touches: unknown[];
|
|
17
|
+
};
|
|
18
|
+
currentTarget: {
|
|
19
|
+
measure: () => void;
|
|
20
|
+
};
|
|
21
|
+
target?: unknown;
|
|
22
|
+
bubbles?: boolean | undefined;
|
|
23
|
+
cancelable?: boolean | undefined;
|
|
24
|
+
defaultPrevented?: boolean | undefined;
|
|
25
|
+
eventPhase?: number | undefined;
|
|
26
|
+
isTrusted?: boolean | undefined;
|
|
27
|
+
preventDefault?: (() => void) | undefined;
|
|
28
|
+
isDefaultPrevented?: (() => boolean) | undefined;
|
|
29
|
+
stopPropagation?: (() => void) | undefined;
|
|
30
|
+
isPropagationStopped?: (() => boolean) | undefined;
|
|
31
|
+
persist?: (() => void) | undefined;
|
|
32
|
+
timeStamp?: number | undefined;
|
|
33
|
+
type?: string | undefined;
|
|
34
|
+
isPersistent: () => boolean;
|
|
35
|
+
};
|
|
36
|
+
export type TouchEvent = ReturnType<typeof buildTouchEvent>;
|
|
37
|
+
export declare function buildResponderGrantEvent(): {
|
|
38
|
+
dispatchConfig: {
|
|
39
|
+
registrationName: string;
|
|
40
|
+
};
|
|
41
|
+
nativeEvent: {
|
|
42
|
+
changedTouches: unknown[];
|
|
43
|
+
identifier: number;
|
|
44
|
+
locationX: number;
|
|
45
|
+
locationY: number;
|
|
46
|
+
pageX: number;
|
|
47
|
+
pageY: number;
|
|
48
|
+
target: number;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
touches: unknown[];
|
|
51
|
+
};
|
|
52
|
+
currentTarget: {
|
|
53
|
+
measure: () => void;
|
|
54
|
+
};
|
|
55
|
+
target?: unknown;
|
|
56
|
+
bubbles?: boolean | undefined;
|
|
57
|
+
cancelable?: boolean | undefined;
|
|
58
|
+
defaultPrevented?: boolean | undefined;
|
|
59
|
+
eventPhase?: number | undefined;
|
|
60
|
+
isTrusted?: boolean | undefined;
|
|
61
|
+
preventDefault?: (() => void) | undefined;
|
|
62
|
+
isDefaultPrevented?: (() => boolean) | undefined;
|
|
63
|
+
stopPropagation?: (() => void) | undefined;
|
|
64
|
+
isPropagationStopped?: (() => boolean) | undefined;
|
|
65
|
+
persist?: (() => void) | undefined;
|
|
66
|
+
timeStamp?: number | undefined;
|
|
67
|
+
type?: string | undefined;
|
|
68
|
+
isPersistent: () => boolean;
|
|
69
|
+
};
|
|
70
|
+
export declare function buildResponderReleaseEvent(): {
|
|
71
|
+
dispatchConfig: {
|
|
72
|
+
registrationName: string;
|
|
73
|
+
};
|
|
74
|
+
nativeEvent: {
|
|
75
|
+
changedTouches: unknown[];
|
|
76
|
+
identifier: number;
|
|
77
|
+
locationX: number;
|
|
78
|
+
locationY: number;
|
|
79
|
+
pageX: number;
|
|
80
|
+
pageY: number;
|
|
81
|
+
target: number;
|
|
82
|
+
timestamp: number;
|
|
83
|
+
touches: unknown[];
|
|
84
|
+
};
|
|
85
|
+
currentTarget: {
|
|
86
|
+
measure: () => void;
|
|
87
|
+
};
|
|
88
|
+
target?: unknown;
|
|
89
|
+
bubbles?: boolean | undefined;
|
|
90
|
+
cancelable?: boolean | undefined;
|
|
91
|
+
defaultPrevented?: boolean | undefined;
|
|
92
|
+
eventPhase?: number | undefined;
|
|
93
|
+
isTrusted?: boolean | undefined;
|
|
94
|
+
preventDefault?: (() => void) | undefined;
|
|
95
|
+
isDefaultPrevented?: (() => boolean) | undefined;
|
|
96
|
+
stopPropagation?: (() => void) | undefined;
|
|
97
|
+
isPropagationStopped?: (() => boolean) | undefined;
|
|
98
|
+
persist?: (() => void) | undefined;
|
|
99
|
+
timeStamp?: number | undefined;
|
|
100
|
+
type?: string | undefined;
|
|
101
|
+
isPersistent: () => boolean;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Experimental values:
|
|
105
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
106
|
+
* - Android: `{"target": 53}`
|
|
107
|
+
*/
|
|
108
|
+
export declare function buildFocusEvent(): {
|
|
109
|
+
nativeEvent: {
|
|
110
|
+
target: number;
|
|
111
|
+
};
|
|
112
|
+
currentTarget?: unknown;
|
|
113
|
+
target?: unknown;
|
|
114
|
+
bubbles?: boolean | undefined;
|
|
115
|
+
cancelable?: boolean | undefined;
|
|
116
|
+
defaultPrevented?: boolean | undefined;
|
|
117
|
+
eventPhase?: number | undefined;
|
|
118
|
+
isTrusted?: boolean | undefined;
|
|
119
|
+
preventDefault?: (() => void) | undefined;
|
|
120
|
+
isDefaultPrevented?: (() => boolean) | undefined;
|
|
121
|
+
stopPropagation?: (() => void) | undefined;
|
|
122
|
+
isPropagationStopped?: (() => boolean) | undefined;
|
|
123
|
+
persist?: (() => void) | undefined;
|
|
124
|
+
timeStamp?: number | undefined;
|
|
125
|
+
type?: string | undefined;
|
|
126
|
+
isPersistent: () => boolean;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Experimental values:
|
|
130
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
131
|
+
* - Android: `{"target": 53}`
|
|
132
|
+
*/
|
|
133
|
+
export declare function buildBlurEvent(): {
|
|
134
|
+
nativeEvent: {
|
|
135
|
+
target: number;
|
|
136
|
+
};
|
|
137
|
+
currentTarget?: unknown;
|
|
138
|
+
target?: unknown;
|
|
139
|
+
bubbles?: boolean | undefined;
|
|
140
|
+
cancelable?: boolean | undefined;
|
|
141
|
+
defaultPrevented?: boolean | undefined;
|
|
142
|
+
eventPhase?: number | undefined;
|
|
143
|
+
isTrusted?: boolean | undefined;
|
|
144
|
+
preventDefault?: (() => void) | undefined;
|
|
145
|
+
isDefaultPrevented?: (() => boolean) | undefined;
|
|
146
|
+
stopPropagation?: (() => void) | undefined;
|
|
147
|
+
isPropagationStopped?: (() => boolean) | undefined;
|
|
148
|
+
persist?: (() => void) | undefined;
|
|
149
|
+
timeStamp?: number | undefined;
|
|
150
|
+
type?: string | undefined;
|
|
151
|
+
isPersistent: () => boolean;
|
|
152
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildBlurEvent = buildBlurEvent;
|
|
7
|
+
exports.buildFocusEvent = buildFocusEvent;
|
|
8
|
+
exports.buildResponderGrantEvent = buildResponderGrantEvent;
|
|
9
|
+
exports.buildResponderReleaseEvent = buildResponderReleaseEvent;
|
|
10
|
+
exports.buildTouchEvent = buildTouchEvent;
|
|
11
|
+
var _base = require("./base");
|
|
12
|
+
/**
|
|
13
|
+
* Experimental values:
|
|
14
|
+
* - iOS: `{"changedTouches": [[Circular]], "identifier": 1, "locationX": 253, "locationY": 30.333328247070312, "pageX": 273, "pageY": 141.3333282470703, "target": 75, "timestamp": 875928682.0450834, "touches": [[Circular]]}`
|
|
15
|
+
* - Android: `{"changedTouches": [[Circular]], "identifier": 0, "locationX": 160, "locationY": 40.3636360168457, "pageX": 180, "pageY": 140.36363220214844, "target": 53, "targetSurface": -1, "timestamp": 10290805, "touches": [[Circular]]}`
|
|
16
|
+
*/
|
|
17
|
+
function buildTouchEvent() {
|
|
18
|
+
return {
|
|
19
|
+
...(0, _base.baseSyntheticEvent)(),
|
|
20
|
+
nativeEvent: {
|
|
21
|
+
changedTouches: [],
|
|
22
|
+
identifier: 0,
|
|
23
|
+
locationX: 0,
|
|
24
|
+
locationY: 0,
|
|
25
|
+
pageX: 0,
|
|
26
|
+
pageY: 0,
|
|
27
|
+
target: 0,
|
|
28
|
+
timestamp: Date.now(),
|
|
29
|
+
touches: []
|
|
30
|
+
},
|
|
31
|
+
currentTarget: {
|
|
32
|
+
measure: () => {}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function buildResponderGrantEvent() {
|
|
37
|
+
return {
|
|
38
|
+
...buildTouchEvent(),
|
|
39
|
+
dispatchConfig: {
|
|
40
|
+
registrationName: 'onResponderGrant'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function buildResponderReleaseEvent() {
|
|
45
|
+
return {
|
|
46
|
+
...buildTouchEvent(),
|
|
47
|
+
dispatchConfig: {
|
|
48
|
+
registrationName: 'onResponderRelease'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Experimental values:
|
|
55
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
56
|
+
* - Android: `{"target": 53}`
|
|
57
|
+
*/
|
|
58
|
+
function buildFocusEvent() {
|
|
59
|
+
return {
|
|
60
|
+
...(0, _base.baseSyntheticEvent)(),
|
|
61
|
+
nativeEvent: {
|
|
62
|
+
target: 0
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Experimental values:
|
|
69
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
70
|
+
* - Android: `{"target": 53}`
|
|
71
|
+
*/
|
|
72
|
+
function buildBlurEvent() {
|
|
73
|
+
return {
|
|
74
|
+
...(0, _base.baseSyntheticEvent)(),
|
|
75
|
+
nativeEvent: {
|
|
76
|
+
target: 0
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":["_base","require","buildTouchEvent","baseSyntheticEvent","nativeEvent","changedTouches","identifier","locationX","locationY","pageX","pageY","target","timestamp","Date","now","touches","currentTarget","measure","buildResponderGrantEvent","dispatchConfig","registrationName","buildResponderReleaseEvent","buildFocusEvent","buildBlurEvent"],"sources":["../../src/event-builder/common.ts"],"sourcesContent":["import { baseSyntheticEvent } from './base';\n\n/**\n * Experimental values:\n * - iOS: `{\"changedTouches\": [[Circular]], \"identifier\": 1, \"locationX\": 253, \"locationY\": 30.333328247070312, \"pageX\": 273, \"pageY\": 141.3333282470703, \"target\": 75, \"timestamp\": 875928682.0450834, \"touches\": [[Circular]]}`\n * - Android: `{\"changedTouches\": [[Circular]], \"identifier\": 0, \"locationX\": 160, \"locationY\": 40.3636360168457, \"pageX\": 180, \"pageY\": 140.36363220214844, \"target\": 53, \"targetSurface\": -1, \"timestamp\": 10290805, \"touches\": [[Circular]]}`\n */\nexport function buildTouchEvent() {\n return {\n ...baseSyntheticEvent(),\n nativeEvent: {\n changedTouches: [] as unknown[],\n identifier: 0,\n locationX: 0,\n locationY: 0,\n pageX: 0,\n pageY: 0,\n target: 0,\n timestamp: Date.now(),\n touches: [] as unknown[],\n },\n currentTarget: { measure: () => {} },\n };\n}\n\nexport type TouchEvent = ReturnType<typeof buildTouchEvent>;\n\nexport function buildResponderGrantEvent() {\n return {\n ...buildTouchEvent(),\n dispatchConfig: { registrationName: 'onResponderGrant' },\n };\n}\n\nexport function buildResponderReleaseEvent() {\n return {\n ...buildTouchEvent(),\n dispatchConfig: { registrationName: 'onResponderRelease' },\n };\n}\n\n/**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\nexport function buildFocusEvent() {\n return {\n ...baseSyntheticEvent(),\n nativeEvent: {\n target: 0,\n },\n };\n}\n\n/**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\nexport function buildBlurEvent() {\n return {\n ...baseSyntheticEvent(),\n nativeEvent: {\n target: 0,\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAAA,EAAG;EAChC,OAAO;IACL,GAAG,IAAAC,wBAAkB,EAAC,CAAC;IACvBC,WAAW,EAAE;MACXC,cAAc,EAAE,EAAe;MAC/BC,UAAU,EAAE,CAAC;MACbC,SAAS,EAAE,CAAC;MACZC,SAAS,EAAE,CAAC;MACZC,KAAK,EAAE,CAAC;MACRC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MACrBC,OAAO,EAAE;IACX,CAAC;IACDC,aAAa,EAAE;MAAEC,OAAO,EAAEA,CAAA,KAAM,CAAC;IAAE;EACrC,CAAC;AACH;AAIO,SAASC,wBAAwBA,CAAA,EAAG;EACzC,OAAO;IACL,GAAGhB,eAAe,CAAC,CAAC;IACpBiB,cAAc,EAAE;MAAEC,gBAAgB,EAAE;IAAmB;EACzD,CAAC;AACH;AAEO,SAASC,0BAA0BA,CAAA,EAAG;EAC3C,OAAO;IACL,GAAGnB,eAAe,CAAC,CAAC;IACpBiB,cAAc,EAAE;MAAEC,gBAAgB,EAAE;IAAqB;EAC3D,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAAA,EAAG;EAChC,OAAO;IACL,GAAG,IAAAnB,wBAAkB,EAAC,CAAC;IACvBC,WAAW,EAAE;MACXO,MAAM,EAAE;IACV;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASY,cAAcA,CAAA,EAAG;EAC/B,OAAO;IACL,GAAG,IAAApB,wBAAkB,EAAC,CAAC;IACvBC,WAAW,EAAE;MACXO,MAAM,EAAE;IACV;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _common = require("./common");
|
|
7
|
+
Object.keys(_common).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _common[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _scroll = require("./scroll");
|
|
18
|
+
Object.keys(_scroll).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _scroll[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _scroll[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _text = require("./text");
|
|
29
|
+
Object.keys(_text).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _text[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _text[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_common","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_scroll","_text"],"sources":["../../src/event-builder/index.ts"],"sourcesContent":["export * from './common';\nexport * from './scroll';\nexport * from './text';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,KAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,KAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,KAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,KAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Point, Size } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Other options for constructing a scroll event.
|
|
4
|
+
*/
|
|
5
|
+
export type ScrollEventOptions = {
|
|
6
|
+
contentSize?: Size;
|
|
7
|
+
layoutMeasurement?: Size;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Experimental values:
|
|
11
|
+
* - iOS: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 5.333333333333333}, "contentSize": {"height": 1676.6666259765625, "width": 390}, "layoutMeasurement": {"height": 753, "width": 390}, "zoomScale": 1}`
|
|
12
|
+
* - 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}}`
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildScrollEvent(offset?: Point, options?: ScrollEventOptions): {
|
|
15
|
+
nativeEvent: {
|
|
16
|
+
contentInset: {
|
|
17
|
+
bottom: number;
|
|
18
|
+
left: number;
|
|
19
|
+
right: number;
|
|
20
|
+
top: number;
|
|
21
|
+
};
|
|
22
|
+
contentOffset: {
|
|
23
|
+
y: number;
|
|
24
|
+
x: number;
|
|
25
|
+
};
|
|
26
|
+
contentSize: {
|
|
27
|
+
height: number;
|
|
28
|
+
width: number;
|
|
29
|
+
};
|
|
30
|
+
layoutMeasurement: {
|
|
31
|
+
height: number;
|
|
32
|
+
width: number;
|
|
33
|
+
};
|
|
34
|
+
responderIgnoreScroll: boolean;
|
|
35
|
+
target: number;
|
|
36
|
+
velocity: {
|
|
37
|
+
y: number;
|
|
38
|
+
x: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
currentTarget?: unknown;
|
|
42
|
+
target?: unknown;
|
|
43
|
+
bubbles?: boolean | undefined;
|
|
44
|
+
cancelable?: boolean | undefined;
|
|
45
|
+
defaultPrevented?: boolean | undefined;
|
|
46
|
+
eventPhase?: number | undefined;
|
|
47
|
+
isTrusted?: boolean | undefined;
|
|
48
|
+
preventDefault?: (() => void) | undefined;
|
|
49
|
+
isDefaultPrevented?: (() => boolean) | undefined;
|
|
50
|
+
stopPropagation?: (() => void) | undefined;
|
|
51
|
+
isPropagationStopped?: (() => boolean) | undefined;
|
|
52
|
+
persist?: (() => void) | undefined;
|
|
53
|
+
timeStamp?: number | undefined;
|
|
54
|
+
type?: string | undefined;
|
|
55
|
+
isPersistent: () => boolean;
|
|
56
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildScrollEvent = buildScrollEvent;
|
|
7
|
+
var _base = require("./base");
|
|
8
|
+
/**
|
|
9
|
+
* Other options for constructing a scroll event.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Experimental values:
|
|
14
|
+
* - iOS: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 5.333333333333333}, "contentSize": {"height": 1676.6666259765625, "width": 390}, "layoutMeasurement": {"height": 753, "width": 390}, "zoomScale": 1}`
|
|
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
|
+
*/
|
|
17
|
+
function buildScrollEvent(offset = {
|
|
18
|
+
y: 0,
|
|
19
|
+
x: 0
|
|
20
|
+
}, options) {
|
|
21
|
+
return {
|
|
22
|
+
...(0, _base.baseSyntheticEvent)(),
|
|
23
|
+
nativeEvent: {
|
|
24
|
+
contentInset: {
|
|
25
|
+
bottom: 0,
|
|
26
|
+
left: 0,
|
|
27
|
+
right: 0,
|
|
28
|
+
top: 0
|
|
29
|
+
},
|
|
30
|
+
contentOffset: {
|
|
31
|
+
y: offset.y,
|
|
32
|
+
x: offset.x
|
|
33
|
+
},
|
|
34
|
+
contentSize: {
|
|
35
|
+
height: options?.contentSize?.height ?? 0,
|
|
36
|
+
width: options?.contentSize?.width ?? 0
|
|
37
|
+
},
|
|
38
|
+
layoutMeasurement: {
|
|
39
|
+
height: options?.layoutMeasurement?.height ?? 0,
|
|
40
|
+
width: options?.layoutMeasurement?.width ?? 0
|
|
41
|
+
},
|
|
42
|
+
responderIgnoreScroll: true,
|
|
43
|
+
target: 0,
|
|
44
|
+
velocity: {
|
|
45
|
+
y: 0,
|
|
46
|
+
x: 0
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=scroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll.js","names":["_base","require","buildScrollEvent","offset","y","x","options","baseSyntheticEvent","nativeEvent","contentInset","bottom","left","right","top","contentOffset","contentSize","height","width","layoutMeasurement","responderIgnoreScroll","target","velocity"],"sources":["../../src/event-builder/scroll.ts"],"sourcesContent":["import type { Point, Size } from '../types';\nimport { baseSyntheticEvent } from './base';\n\n/**\n * Other options for constructing a scroll event.\n */\nexport type ScrollEventOptions = {\n contentSize?: Size;\n layoutMeasurement?: Size;\n};\n\n/**\n * Experimental values:\n * - iOS: `{\"contentInset\": {\"bottom\": 0, \"left\": 0, \"right\": 0, \"top\": 0}, \"contentOffset\": {\"x\": 0, \"y\": 5.333333333333333}, \"contentSize\": {\"height\": 1676.6666259765625, \"width\": 390}, \"layoutMeasurement\": {\"height\": 753, \"width\": 390}, \"zoomScale\": 1}`\n * - 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}}`\n */\nexport function buildScrollEvent(offset: Point = { y: 0, x: 0 }, options?: ScrollEventOptions) {\n return {\n ...baseSyntheticEvent(),\n nativeEvent: {\n contentInset: { bottom: 0, left: 0, right: 0, top: 0 },\n contentOffset: { y: offset.y, x: offset.x },\n contentSize: {\n height: options?.contentSize?.height ?? 0,\n width: options?.contentSize?.width ?? 0,\n },\n layoutMeasurement: {\n height: options?.layoutMeasurement?.height ?? 0,\n width: options?.layoutMeasurement?.width ?? 0,\n },\n responderIgnoreScroll: true,\n target: 0,\n velocity: { y: 0, x: 0 },\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAACC,MAAa,GAAG;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE;AAAE,CAAC,EAAEC,OAA4B,EAAE;EAC7F,OAAO;IACL,GAAG,IAAAC,wBAAkB,EAAC,CAAC;IACvBC,WAAW,EAAE;MACXC,YAAY,EAAE;QAAEC,MAAM,EAAE,CAAC;QAAEC,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAE,CAAC;QAAEC,GAAG,EAAE;MAAE,CAAC;MACtDC,aAAa,EAAE;QAAEV,CAAC,EAAED,MAAM,CAACC,CAAC;QAAEC,CAAC,EAAEF,MAAM,CAACE;MAAE,CAAC;MAC3CU,WAAW,EAAE;QACXC,MAAM,EAAEV,OAAO,EAAES,WAAW,EAAEC,MAAM,IAAI,CAAC;QACzCC,KAAK,EAAEX,OAAO,EAAES,WAAW,EAAEE,KAAK,IAAI;MACxC,CAAC;MACDC,iBAAiB,EAAE;QACjBF,MAAM,EAAEV,OAAO,EAAEY,iBAAiB,EAAEF,MAAM,IAAI,CAAC;QAC/CC,KAAK,EAAEX,OAAO,EAAEY,iBAAiB,EAAED,KAAK,IAAI;MAC9C,CAAC;MACDE,qBAAqB,EAAE,IAAI;MAC3BC,MAAM,EAAE,CAAC;MACTC,QAAQ,EAAE;QAAEjB,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE;IACzB;EACF,CAAC;AACH","ignoreList":[]}
|