@testing-library/react-native 14.0.0-alpha.6 → 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 +30 -30
- package/build/config.js +10 -4
- package/build/config.js.map +1 -1
- package/build/event-builder/base.d.ts +7 -0
- package/build/{user-event/event-builder → event-builder}/base.js +1 -1
- 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/event-handler.d.ts +0 -1
- package/build/event-handler.js +0 -1
- package/build/event-handler.js.map +1 -1
- package/build/fire-event.d.ts +6 -7
- package/build/fire-event.js +47 -28
- 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/errors.d.ts +1 -3
- package/build/helpers/errors.js +3 -36
- package/build/helpers/errors.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/helpers/validate-options.d.ts +9 -0
- package/build/helpers/validate-options.js +32 -0
- package/build/helpers/validate-options.js.map +1 -0
- 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-hook.js +7 -1
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +4 -5
- package/build/render.js +22 -6
- 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/test-utils/timers.d.ts +2 -0
- package/build/test-utils/timers.js +20 -0
- package/build/test-utils/timers.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 +17 -3
- 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/wait-for.js +8 -13
- package/build/wait-for.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/react-versions.d.ts +0 -1
- package/build/react-versions.js +0 -14
- package/build/react-versions.js.map +0 -1
- package/build/tsconfig.release.tsbuildinfo +0 -1
- package/build/user-event/event-builder/base.d.ts +0 -3
- package/build/user-event/event-builder/base.js.map +0 -1
- package/build/user-event/event-builder/common.d.ts +0 -150
- 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 -306
- 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 -57
- 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 -159
- 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/README.md
CHANGED
|
@@ -12,13 +12,18 @@
|
|
|
12
12
|
[![MIT License][license-badge]][license]
|
|
13
13
|
[![Sponsored by Callstack][callstack-badge]][callstack]
|
|
14
14
|
|
|
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).
|
|
19
|
+
|
|
15
20
|
## The problem
|
|
16
21
|
|
|
17
|
-
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.
|
|
18
23
|
|
|
19
24
|
## This solution
|
|
20
25
|
|
|
21
|
-
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:
|
|
22
27
|
|
|
23
28
|
> The more your tests resemble the way your software is used, the more confidence they can give you.
|
|
24
29
|
|
|
@@ -29,14 +34,14 @@ This project is inspired by [React Testing Library](https://github.com/testing-l
|
|
|
29
34
|
Open a Terminal in your project's folder and run:
|
|
30
35
|
|
|
31
36
|
```sh
|
|
32
|
-
|
|
33
|
-
yarn add --dev @testing-library/react-native
|
|
34
|
-
|
|
35
|
-
# NPM install
|
|
36
|
-
npm install --save-dev @testing-library/react-native
|
|
37
|
+
npm install --save-dev @testing-library/react-native@alpha
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
This library has a `peerDependencies` listing for
|
|
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:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install --save-dev test-renderer
|
|
44
|
+
```
|
|
40
45
|
|
|
41
46
|
### Additional Jest matchers
|
|
42
47
|
|
|
@@ -48,16 +53,12 @@ You can use the built-in Jest matchers automatically by having any import from `
|
|
|
48
53
|
import { render, screen, userEvent } from '@testing-library/react-native';
|
|
49
54
|
import { QuestionsBoard } from '../QuestionsBoard';
|
|
50
55
|
|
|
51
|
-
// It is recommended to use userEvent with fake timers
|
|
52
|
-
// Some events involve duration so your tests may take a long time to run.
|
|
53
|
-
jest.useFakeTimers();
|
|
54
|
-
|
|
55
56
|
test('form submits two answers', async () => {
|
|
56
57
|
const questions = ['q1', 'q2'];
|
|
57
58
|
const onSubmit = jest.fn();
|
|
58
59
|
|
|
59
60
|
const user = userEvent.setup();
|
|
60
|
-
render(<QuestionsBoard questions={questions} onSubmit={onSubmit} />);
|
|
61
|
+
await render(<QuestionsBoard questions={questions} onSubmit={onSubmit} />);
|
|
61
62
|
|
|
62
63
|
const answerInputs = screen.getAllByLabelText('answer input');
|
|
63
64
|
|
|
@@ -81,33 +82,32 @@ You can find the source of `QuestionsBoard` component and this example [here](ht
|
|
|
81
82
|
|
|
82
83
|
React Native Testing Library consists of following APIs:
|
|
83
84
|
|
|
84
|
-
- [`render` function](https://callstack.
|
|
85
|
-
- [`screen` object](https://callstack.
|
|
86
|
-
- [Queries](https://callstack.
|
|
87
|
-
- Lifecycle methods: [`rerender`](https://callstack.
|
|
88
|
-
- Helpers: [`debug`](https://callstack.
|
|
89
|
-
- [Jest matchers](https://callstack.
|
|
90
|
-
- [User Event](https://callstack.
|
|
91
|
-
- [Fire Event](https://callstack.
|
|
92
|
-
- [`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
|
|
93
94
|
- Miscellaneous APIs:
|
|
94
|
-
- [Async utils](https://callstack.
|
|
95
|
-
- [Configuration](https://callstack.
|
|
96
|
-
- [Accessibility](https://callstack.
|
|
97
|
-
- [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`
|
|
98
99
|
|
|
99
100
|
## Migration Guides
|
|
100
101
|
|
|
101
|
-
- [Migration to
|
|
102
|
-
- [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
|
|
103
103
|
|
|
104
104
|
## Troubleshooting
|
|
105
105
|
|
|
106
|
-
- [Troubleshooting guide](https://callstack.
|
|
106
|
+
- [Troubleshooting guide](https://oss.callstack.com/react-native-testing-library/docs/guides/troubleshooting)
|
|
107
107
|
|
|
108
108
|
## Community Resources
|
|
109
109
|
|
|
110
|
-
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).
|
|
111
111
|
|
|
112
112
|
## Made with ❤️ at Callstack
|
|
113
113
|
|
package/build/config.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.configure = configure;
|
|
7
7
|
exports.getConfig = getConfig;
|
|
8
8
|
exports.resetToDefaults = resetToDefaults;
|
|
9
|
+
var _validateOptions = require("./helpers/validate-options");
|
|
9
10
|
/**
|
|
10
11
|
* Global configuration options for React Native Testing Library.
|
|
11
12
|
*/
|
|
@@ -23,14 +24,19 @@ let config = {
|
|
|
23
24
|
*/
|
|
24
25
|
function configure(options) {
|
|
25
26
|
const {
|
|
27
|
+
asyncUtilTimeout,
|
|
28
|
+
defaultDebugOptions,
|
|
26
29
|
defaultHidden,
|
|
27
|
-
|
|
30
|
+
defaultIncludeHiddenElements,
|
|
31
|
+
...rest
|
|
28
32
|
} = options;
|
|
29
|
-
|
|
33
|
+
(0, _validateOptions.validateOptions)('configure', rest, configure);
|
|
34
|
+
const resolvedDefaultIncludeHiddenElements = defaultIncludeHiddenElements ?? defaultHidden ?? config.defaultIncludeHiddenElements;
|
|
30
35
|
config = {
|
|
31
36
|
...config,
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
asyncUtilTimeout: asyncUtilTimeout ?? config.asyncUtilTimeout,
|
|
38
|
+
defaultDebugOptions,
|
|
39
|
+
defaultIncludeHiddenElements: resolvedDefaultIncludeHiddenElements
|
|
34
40
|
};
|
|
35
41
|
}
|
|
36
42
|
function resetToDefaults() {
|
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","config","configure","options","defaultHidden","
|
|
1
|
+
{"version":3,"file":"config.js","names":["_validateOptions","require","defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","config","configure","options","defaultDebugOptions","defaultHidden","rest","validateOptions","resolvedDefaultIncludeHiddenElements","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import type { DebugOptions } from './helpers/debug';\nimport { validateOptions } from './helpers/validate-options';\n\n/**\n * Global configuration options for React Native Testing Library.\n */\n\nexport type Config = {\n /** Default timeout, in ms, for `waitFor` and `findBy*` queries. */\n asyncUtilTimeout: number;\n\n /** Default value for `includeHiddenElements` query option. */\n defaultIncludeHiddenElements: boolean;\n\n /** Default options for `debug` helper. */\n defaultDebugOptions?: Partial<DebugOptions>;\n};\n\nexport type ConfigAliasOptions = {\n /** RTL-compatibility alias to `defaultIncludeHiddenElements` */\n defaultHidden: boolean;\n};\n\nconst defaultConfig: Config = {\n asyncUtilTimeout: 1000,\n defaultIncludeHiddenElements: false,\n};\n\nlet config = { ...defaultConfig };\n\n/**\n * Configure global options for React Native Testing Library.\n */\nexport function configure(options: Partial<Config & ConfigAliasOptions>) {\n const {\n asyncUtilTimeout,\n defaultDebugOptions,\n defaultHidden,\n defaultIncludeHiddenElements,\n ...rest\n } = options;\n\n validateOptions('configure', rest, configure);\n\n const resolvedDefaultIncludeHiddenElements =\n defaultIncludeHiddenElements ?? defaultHidden ?? config.defaultIncludeHiddenElements;\n\n config = {\n ...config,\n asyncUtilTimeout: asyncUtilTimeout ?? config.asyncUtilTimeout,\n defaultDebugOptions,\n defaultIncludeHiddenElements: resolvedDefaultIncludeHiddenElements,\n };\n}\n\nexport function resetToDefaults() {\n config = { ...defaultConfig };\n}\n\nexport function getConfig() {\n return config;\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAEA;AACA;AACA;;AAkBA,MAAMC,aAAqB,GAAG;EAC5BC,gBAAgB,EAAE,IAAI;EACtBC,4BAA4B,EAAE;AAChC,CAAC;AAED,IAAIC,MAAM,GAAG;EAAE,GAAGH;AAAc,CAAC;;AAEjC;AACA;AACA;AACO,SAASI,SAASA,CAACC,OAA6C,EAAE;EACvE,MAAM;IACJJ,gBAAgB;IAChBK,mBAAmB;IACnBC,aAAa;IACbL,4BAA4B;IAC5B,GAAGM;EACL,CAAC,GAAGH,OAAO;EAEX,IAAAI,gCAAe,EAAC,WAAW,EAAED,IAAI,EAAEJ,SAAS,CAAC;EAE7C,MAAMM,oCAAoC,GACxCR,4BAA4B,IAAIK,aAAa,IAAIJ,MAAM,CAACD,4BAA4B;EAEtFC,MAAM,GAAG;IACP,GAAGA,MAAM;IACTF,gBAAgB,EAAEA,gBAAgB,IAAIE,MAAM,CAACF,gBAAgB;IAC7DK,mBAAmB;IACnBJ,4BAA4B,EAAEQ;EAChC,CAAC;AACH;AAEO,SAASC,eAAeA,CAAA,EAAG;EAChCR,MAAM,GAAG;IAAE,GAAGH;EAAc,CAAC;AAC/B;AAEO,SAASY,SAASA,CAAA,EAAG;EAC1B,OAAOT,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BaseSyntheticEvent } from 'react';
|
|
2
|
+
/** Builds base syntentic event stub, with prop values as inspected in RN runtime. */
|
|
3
|
+
type BaseEvent = Partial<BaseSyntheticEvent<object, unknown, unknown>> & {
|
|
4
|
+
isPersistent: () => boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function baseSyntheticEvent(): BaseEvent;
|
|
7
|
+
export {};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.baseSyntheticEvent = baseSyntheticEvent;
|
|
7
7
|
/** Builds base syntentic event stub, with prop values as inspected in RN runtime. */
|
|
8
|
+
|
|
8
9
|
function baseSyntheticEvent() {
|
|
9
10
|
return {
|
|
10
11
|
currentTarget: {},
|
|
@@ -14,7 +15,6 @@ function baseSyntheticEvent() {
|
|
|
14
15
|
stopPropagation: () => {},
|
|
15
16
|
isPropagationStopped: () => false,
|
|
16
17
|
persist: () => {},
|
|
17
|
-
// @ts-expect-error: `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
|
|
18
18
|
isPersistent: () => false,
|
|
19
19
|
timeStamp: 0
|
|
20
20
|
};
|
|
@@ -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":[]}
|