@testing-library/react-native 12.2.0 → 12.2.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/.DS_Store +0 -0
- package/.eslintcache +1 -1
- package/.eslintignore +1 -0
- package/build/fireEvent.js +1 -1
- package/build/fireEvent.js.map +1 -1
- package/build/helpers/component-tree.d.ts +11 -5
- package/build/helpers/component-tree.js +5 -1
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/findAll.d.ts +2 -1
- package/build/helpers/findAll.js +2 -1
- package/build/helpers/findAll.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +11 -2
- package/build/helpers/host-component-names.js +10 -0
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/matchLabelText.js +1 -1
- package/build/helpers/matchers/matchLabelText.js.map +1 -1
- package/build/queries/a11yState.js +1 -1
- package/build/queries/a11yState.js.map +1 -1
- package/build/queries/a11yValue.js +1 -1
- package/build/queries/a11yValue.js.map +1 -1
- package/build/queries/displayValue.js +5 -6
- package/build/queries/displayValue.js.map +1 -1
- package/build/queries/hintText.js +1 -1
- package/build/queries/hintText.js.map +1 -1
- package/build/queries/labelText.js +1 -1
- package/build/queries/labelText.js.map +1 -1
- package/build/queries/placeholderText.js +3 -4
- package/build/queries/placeholderText.js.map +1 -1
- package/build/queries/role.js +1 -1
- package/build/queries/role.js.map +1 -1
- package/build/queries/testId.js +3 -3
- package/build/queries/testId.js.map +1 -1
- package/build/queries/text.js +1 -2
- package/build/queries/text.js.map +1 -1
- package/build/render.js.map +1 -1
- package/build/user-event/clear.d.ts +3 -0
- package/build/user-event/clear.js +41 -0
- package/build/user-event/clear.js.map +1 -0
- package/build/user-event/index.d.ts +1 -0
- package/build/user-event/index.js +2 -1
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/press/press.js +1 -4
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/setup/setup.d.ts +14 -2
- package/build/user-event/setup/setup.js +3 -1
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.d.ts +2 -1
- package/build/user-event/type/type.js +8 -4
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/host-components.d.ts +2 -0
- package/build/user-event/utils/host-components.js +11 -0
- package/build/user-event/utils/host-components.js.map +1 -0
- package/build/user-event/utils/index.d.ts +1 -0
- package/build/user-event/utils/index.js +11 -0
- package/build/user-event/utils/index.js.map +1 -1
- package/build/user-event/utils/text-range.d.ts +0 -1
- package/build/user-event/utils/text-range.js +0 -11
- package/build/user-event/utils/text-range.js.map +1 -1
- package/examples/basic/.expo/README.md +4 -6
- package/examples/basic/.expo/settings.json +2 -0
- package/examples/basic/__tests__/App.test.tsx +30 -12
- package/examples/basic/package.json +1 -1
- package/examples/basic/yarn.lock +2095 -3474
- package/examples/react-navigation/yarn.lock +1657 -2249
- package/examples/redux/yarn.lock +1772 -5376
- package/experiments-app/.expo/packager-info.json +9 -0
- package/experiments-app/.expo/settings.json +1 -2
- package/experiments-app/package.json +7 -9
- package/experiments-app/src/MainScreen.tsx +1 -0
- package/experiments-app/src/experiments.ts +20 -2
- package/experiments-app/src/screens/FlatListEvents.tsx +57 -0
- package/experiments-app/src/screens/ScrollViewEvents.tsx +65 -0
- package/experiments-app/src/screens/SectionListEvents.tsx +91 -0
- package/experiments-app/src/screens/TextInputEventPropagation.tsx +5 -17
- package/experiments-app/src/screens/TextInputEvents.tsx +13 -25
- package/experiments-app/src/utils/helpers.ts +13 -3
- package/experiments-app/yarn.lock +901 -1105
- package/experiments-rtl/.babelrc +8 -0
- package/experiments-rtl/.eslintrc.json +3 -0
- package/experiments-rtl/.gitignore +35 -0
- package/experiments-rtl/README.md +34 -0
- package/experiments-rtl/jest-setup.js +1 -0
- package/experiments-rtl/jest.config.js +4 -0
- package/experiments-rtl/next.config.js +4 -0
- package/experiments-rtl/package.json +38 -0
- package/experiments-rtl/postcss.config.js +6 -0
- package/experiments-rtl/public/next.svg +1 -0
- package/experiments-rtl/public/vercel.svg +1 -0
- package/experiments-rtl/src/app/__tests__/click.test.tsx +31 -0
- package/experiments-rtl/src/app/__tests__/managed-text-input.test.tsx +51 -0
- package/experiments-rtl/src/app/globals.css +27 -0
- package/experiments-rtl/src/app/layout.tsx +22 -0
- package/experiments-rtl/src/app/page.tsx +113 -0
- package/experiments-rtl/tailwind.config.ts +20 -0
- package/experiments-rtl/tsconfig.json +28 -0
- package/experiments-rtl/yarn.lock +5418 -0
- package/package.json +4 -2
- package/src/fireEvent.ts +1 -1
- package/src/helpers/component-tree.ts +14 -9
- package/src/helpers/findAll.ts +6 -4
- package/src/helpers/host-component-names.tsx +15 -2
- package/src/helpers/matchers/matchLabelText.ts +0 -1
- package/src/queries/a11yState.ts +2 -6
- package/src/queries/a11yValue.ts +2 -6
- package/src/queries/displayValue.ts +7 -14
- package/src/queries/hintText.ts +2 -7
- package/src/queries/labelText.ts +1 -3
- package/src/queries/placeholderText.ts +6 -13
- package/src/queries/role.ts +1 -2
- package/src/queries/testId.ts +5 -10
- package/src/queries/text.ts +3 -6
- package/src/render.tsx +1 -1
- package/src/user-event/__tests__/__snapshots__/clear.test.tsx.snap +269 -0
- package/src/user-event/__tests__/clear.test.tsx +217 -0
- package/src/user-event/clear.ts +59 -0
- package/src/user-event/index.ts +1 -0
- package/src/user-event/press/press.ts +8 -14
- package/src/user-event/setup/setup.ts +17 -2
- package/src/user-event/type/__tests__/type-managed.test.tsx +0 -1
- package/src/user-event/type/__tests__/type.test.tsx +0 -1
- package/src/user-event/type/type.ts +16 -13
- package/src/user-event/utils/__tests__/wait.test.ts +0 -1
- package/src/user-event/utils/host-components.ts +6 -0
- package/src/user-event/utils/index.ts +1 -0
- package/src/user-event/utils/text-range.ts +0 -7
- package/website/docs/Queries.md +64 -59
- package/website/docs/UserEvent.md +48 -0
- package/build/helpers/filterNodeByType.d.ts +0 -3
- package/build/helpers/filterNodeByType.js +0 -9
- package/build/helpers/filterNodeByType.js.map +0 -1
- package/coverage/clover.xml +0 -1176
- package/coverage/coverage-final.json +0 -70
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -266
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/act.ts.html +0 -343
- package/coverage/lcov-report/src/cleanup.ts.html +0 -130
- package/coverage/lcov-report/src/config.ts.html +0 -301
- package/coverage/lcov-report/src/fireEvent.ts.html +0 -559
- package/coverage/lcov-report/src/flushMicroTasks.ts.html +0 -124
- package/coverage/lcov-report/src/helpers/accessiblity.ts.html +0 -412
- package/coverage/lcov-report/src/helpers/component-tree.ts.html +0 -352
- package/coverage/lcov-report/src/helpers/debugDeep.ts.html +0 -166
- package/coverage/lcov-report/src/helpers/debugShallow.ts.html +0 -151
- package/coverage/lcov-report/src/helpers/deprecation.ts.html +0 -244
- package/coverage/lcov-report/src/helpers/errors.ts.html +0 -283
- package/coverage/lcov-report/src/helpers/filterNodeByType.ts.html +0 -106
- package/coverage/lcov-report/src/helpers/findAll.ts.html +0 -289
- package/coverage/lcov-report/src/helpers/format-default.ts.html +0 -301
- package/coverage/lcov-report/src/helpers/format.ts.html +0 -226
- package/coverage/lcov-report/src/helpers/getTextContent.ts.html +0 -145
- package/coverage/lcov-report/src/helpers/host-component-names.tsx.html +0 -286
- package/coverage/lcov-report/src/helpers/index.html +0 -326
- package/coverage/lcov-report/src/helpers/matchers/accessibilityState.ts.html +0 -229
- package/coverage/lcov-report/src/helpers/matchers/accessibilityValue.ts.html +0 -157
- package/coverage/lcov-report/src/helpers/matchers/index.html +0 -206
- package/coverage/lcov-report/src/helpers/matchers/matchArrayProp.ts.html +0 -148
- package/coverage/lcov-report/src/helpers/matchers/matchLabelText.ts.html +0 -238
- package/coverage/lcov-report/src/helpers/matchers/matchObjectProp.ts.html +0 -160
- package/coverage/lcov-report/src/helpers/matchers/matchStringProp.ts.html +0 -154
- package/coverage/lcov-report/src/helpers/matchers/matchTextContent.ts.html +0 -145
- package/coverage/lcov-report/src/helpers/query-name.ts.html +0 -97
- package/coverage/lcov-report/src/helpers/stringValidation.ts.html +0 -193
- package/coverage/lcov-report/src/helpers/timers.ts.html +0 -382
- package/coverage/lcov-report/src/index.html +0 -356
- package/coverage/lcov-report/src/index.ts.html +0 -184
- package/coverage/lcov-report/src/matches.ts.html +0 -232
- package/coverage/lcov-report/src/pure.ts.html +0 -157
- package/coverage/lcov-report/src/queries/a11yState.ts.html +0 -478
- package/coverage/lcov-report/src/queries/a11yValue.ts.html +0 -478
- package/coverage/lcov-report/src/queries/displayValue.ts.html +0 -319
- package/coverage/lcov-report/src/queries/hintText.ts.html +0 -421
- package/coverage/lcov-report/src/queries/index.html +0 -281
- package/coverage/lcov-report/src/queries/labelText.ts.html +0 -262
- package/coverage/lcov-report/src/queries/makeQueries.ts.html +0 -850
- package/coverage/lcov-report/src/queries/placeholderText.ts.html +0 -322
- package/coverage/lcov-report/src/queries/role.ts.html +0 -481
- package/coverage/lcov-report/src/queries/testId.ts.html +0 -298
- package/coverage/lcov-report/src/queries/text.ts.html +0 -283
- package/coverage/lcov-report/src/queries/unsafeProps.ts.html +0 -313
- package/coverage/lcov-report/src/queries/unsafeType.ts.html +0 -304
- package/coverage/lcov-report/src/react-versions.ts.html +0 -118
- package/coverage/lcov-report/src/render-act.ts.html +0 -142
- package/coverage/lcov-report/src/render.tsx.html +0 -592
- package/coverage/lcov-report/src/renderHook.tsx.html +0 -262
- package/coverage/lcov-report/src/screen.ts.html +0 -454
- package/coverage/lcov-report/src/shallow.ts.html +0 -139
- package/coverage/lcov-report/src/test-utils/events.ts.html +0 -145
- package/coverage/lcov-report/src/test-utils/index.html +0 -131
- package/coverage/lcov-report/src/test-utils/index.ts.html +0 -88
- package/coverage/lcov-report/src/user-event/event-builder/common.ts.html +0 -229
- package/coverage/lcov-report/src/user-event/event-builder/index.html +0 -146
- package/coverage/lcov-report/src/user-event/event-builder/index.ts.html +0 -106
- package/coverage/lcov-report/src/user-event/event-builder/test-input.ts.html +0 -343
- package/coverage/lcov-report/src/user-event/event-builder/text-input.ts.html +0 -343
- package/coverage/lcov-report/src/user-event/index.html +0 -116
- package/coverage/lcov-report/src/user-event/index.ts.html +0 -121
- package/coverage/lcov-report/src/user-event/press/index.html +0 -131
- package/coverage/lcov-report/src/user-event/press/index.ts.html +0 -88
- package/coverage/lcov-report/src/user-event/press/press.ts.html +0 -133
- package/coverage/lcov-report/src/user-event/setup/index.html +0 -131
- package/coverage/lcov-report/src/user-event/setup/index.ts.html +0 -91
- package/coverage/lcov-report/src/user-event/setup/setup.ts.html +0 -358
- package/coverage/lcov-report/src/user-event/type/index.html +0 -146
- package/coverage/lcov-report/src/user-event/type/index.ts.html +0 -88
- package/coverage/lcov-report/src/user-event/type/parseKeys.ts.html +0 -208
- package/coverage/lcov-report/src/user-event/type/type.ts.html +0 -484
- package/coverage/lcov-report/src/user-event/utils/content-size.ts.html +0 -160
- package/coverage/lcov-report/src/user-event/utils/dispatch-event.ts.html +0 -367
- package/coverage/lcov-report/src/user-event/utils/events.ts.html +0 -247
- package/coverage/lcov-report/src/user-event/utils/index.html +0 -176
- package/coverage/lcov-report/src/user-event/utils/index.ts.html +0 -97
- package/coverage/lcov-report/src/user-event/utils/text-range.ts.html +0 -118
- package/coverage/lcov-report/src/user-event/utils/wait.ts.html +0 -130
- package/coverage/lcov-report/src/waitFor.ts.html +0 -772
- package/coverage/lcov-report/src/waitForElementToBeRemoved.ts.html +0 -211
- package/coverage/lcov-report/src/within.ts.html +0 -175
- package/coverage/lcov.info +0 -2614
- package/examples/.DS_Store +0 -0
- package/examples/basic/.expo/devices.json +0 -3
- package/examples/basic/yarn-error.log +0 -8083
- package/examples/redux/yarn-error.log +0 -8083
- package/src/.DS_Store +0 -0
- package/src/__tests__/.DS_Store +0 -0
- package/src/helpers/filterNodeByType.ts +0 -7
- package/website/.DS_Store +0 -0
- package/website/.docusaurus/DONT-EDIT-THIS-FOLDER +0 -5
- package/website/.docusaurus/client-modules.js +0 -6
- package/website/.docusaurus/codeTranslations.json +0 -1
- package/website/.docusaurus/docusaurus-plugin-content-blog/default/blog-post-list-prop-default.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-content-blog/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-api-md-c82.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-eslint-p-llugin-testing-library-md-d24.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-faq-md-ad8.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-getting-started-md-8a6.json +0 -23
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-how-should-i-query-md-f2d.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-11-md-add.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-12-md-14f.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-2-md-698.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-7-md-6bb.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-9-md-f69.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-queries-md-7ad.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-react-navigation-md-1bd.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-redux-integration-md-77b.json +0 -23
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-testing-environment-md-1c6.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-troubleshooting-md-01d.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-understanding-act-md-aa9.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-user-event-md-501.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/version-current-metadata-prop-751.json +0 -268
- package/website/.docusaurus/docusaurus-plugin-content-docs/react-native-testing-library-docs-route-96e.json +0 -115
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-api-md-c82.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-eslint-p-llugin-testing-library-md-d24.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-faq-md-ad8.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-getting-started-md-8a6.json +0 -15
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-how-should-i-query-md-f2d.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-11-md-add.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-2-md-698.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-7-md-6bb.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-9-md-f69.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-queries-md-7ad.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-react-navigation-md-1bd.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-redux-integration-md-77b.json +0 -15
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-troubleshooting-md-01d.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-understanding-act-md-aa9.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-debug/default/docusaurus-debug-all-content-673.json +0 -623
- package/website/.docusaurus/docusaurus-plugin-debug/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus.config.js +0 -267
- package/website/.docusaurus/docusaurus.config.mjs +0 -365
- package/website/.docusaurus/globalData.json +0 -113
- package/website/.docusaurus/i18n.json +0 -17
- package/website/.docusaurus/registry.js +0 -35
- package/website/.docusaurus/routes.js +0 -162
- package/website/.docusaurus/routesChunkNames.json +0 -133
- package/website/.docusaurus/site-metadata.json +0 -36
- package/yarn-error.log +0 -10613
|
@@ -14,18 +14,16 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@react-navigation/native": "^6.1.6",
|
|
16
16
|
"@react-navigation/native-stack": "^6.9.12",
|
|
17
|
-
"
|
|
18
|
-
"expo": "~
|
|
19
|
-
"expo-status-bar": "~1.4.4",
|
|
17
|
+
"expo": "^49.0.0",
|
|
18
|
+
"expo-status-bar": "~1.6.0",
|
|
20
19
|
"react": "18.2.0",
|
|
21
|
-
"react-native": "0.
|
|
22
|
-
"react-native-safe-area-context": "4.
|
|
23
|
-
"react-native-screens": "~3.
|
|
24
|
-
"yarn": "^1.22.19"
|
|
20
|
+
"react-native": "0.72.3",
|
|
21
|
+
"react-native-safe-area-context": "4.6.3",
|
|
22
|
+
"react-native-screens": "~3.22.0"
|
|
25
23
|
},
|
|
26
24
|
"devDependencies": {
|
|
27
25
|
"@babel/core": "^7.20.0",
|
|
28
|
-
"@types/react": "~18.
|
|
29
|
-
"typescript": "^
|
|
26
|
+
"@types/react": "~18.2.14",
|
|
27
|
+
"typescript": "^5.1.3"
|
|
30
28
|
}
|
|
31
29
|
}
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { TextInputEventPropagation } from './screens/TextInputEventPropagation';
|
|
2
2
|
import { TextInputEvents } from './screens/TextInputEvents';
|
|
3
|
+
import { ScrollViewEvents } from './screens/ScrollViewEvents';
|
|
4
|
+
import { FlatListEvents } from './screens/FlatListEvents';
|
|
5
|
+
import { SectionListEvents } from './screens/SectionListEvents';
|
|
3
6
|
|
|
4
7
|
export type Experiment = (typeof experiments)[number];
|
|
5
8
|
|
|
6
9
|
export const experiments = [
|
|
7
10
|
{
|
|
8
|
-
key: '
|
|
11
|
+
key: 'TextInputEvents',
|
|
9
12
|
title: 'TextInput Events',
|
|
10
13
|
component: TextInputEvents,
|
|
11
14
|
},
|
|
12
15
|
{
|
|
13
|
-
key: '
|
|
16
|
+
key: 'TextInputEventPropagation',
|
|
14
17
|
title: 'TextInput Event Propagation',
|
|
15
18
|
component: TextInputEventPropagation,
|
|
16
19
|
},
|
|
20
|
+
{
|
|
21
|
+
key: 'ScrollViewEvents',
|
|
22
|
+
title: 'ScrollView Events',
|
|
23
|
+
component: ScrollViewEvents,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'FlatListEvents',
|
|
27
|
+
title: 'FlatList Events',
|
|
28
|
+
component: FlatListEvents,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: 'SectionListEvents',
|
|
32
|
+
title: 'SectionList Events',
|
|
33
|
+
component: SectionListEvents,
|
|
34
|
+
},
|
|
17
35
|
];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { FlatList, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { customEventLogger, nativeEventLogger } from '../utils/helpers';
|
|
4
|
+
|
|
5
|
+
interface ItemData {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const data: ItemData[] = [...new Array(25)].map((_, index) => ({
|
|
11
|
+
id: `${index + 1}`,
|
|
12
|
+
title: `Item ${index + 1}`,
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
export function FlatListEvents() {
|
|
16
|
+
const renderItem = ({ item }: { item: ItemData }) => {
|
|
17
|
+
return <Item item={item} />;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<FlatList
|
|
22
|
+
data={data}
|
|
23
|
+
renderItem={renderItem}
|
|
24
|
+
keyExtractor={(item) => item.id}
|
|
25
|
+
contentInsetAdjustmentBehavior="scrollableAxes"
|
|
26
|
+
scrollEventThrottle={150}
|
|
27
|
+
onScroll={nativeEventLogger('scroll')}
|
|
28
|
+
onScrollBeginDrag={nativeEventLogger('scrollBeginDrag')}
|
|
29
|
+
onScrollEndDrag={nativeEventLogger('scrollEndDrag')}
|
|
30
|
+
onMomentumScrollBegin={nativeEventLogger('momentumScrollBegin')}
|
|
31
|
+
onMomentumScrollEnd={nativeEventLogger('momentumScrollEnd')}
|
|
32
|
+
onScrollToTop={nativeEventLogger('scrollToTop')}
|
|
33
|
+
onEndReached={customEventLogger('endReached')}
|
|
34
|
+
onContentSizeChange={customEventLogger('contentSizeChange')}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface ItemProps {
|
|
40
|
+
item: ItemData;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const Item = ({ item }: ItemProps) => (
|
|
44
|
+
<View style={styles.item}>
|
|
45
|
+
<Text style={styles.title}>{item.title}</Text>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
item: {
|
|
51
|
+
paddingVertical: 16,
|
|
52
|
+
paddingHorizontal: 20,
|
|
53
|
+
},
|
|
54
|
+
title: {
|
|
55
|
+
fontSize: 20,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet, Text, ScrollView } from 'react-native';
|
|
3
|
+
import { customEventLogger, nativeEventLogger } from '../utils/helpers';
|
|
4
|
+
|
|
5
|
+
export function ScrollViewEvents() {
|
|
6
|
+
return (
|
|
7
|
+
<ScrollView
|
|
8
|
+
contentInsetAdjustmentBehavior="scrollableAxes"
|
|
9
|
+
scrollEventThrottle={150}
|
|
10
|
+
onScroll={nativeEventLogger('scroll')}
|
|
11
|
+
onScrollBeginDrag={nativeEventLogger('scrollBeginDrag')}
|
|
12
|
+
onScrollEndDrag={nativeEventLogger('scrollEndDrag')}
|
|
13
|
+
onMomentumScrollBegin={nativeEventLogger('momentumScrollBegin')}
|
|
14
|
+
onMomentumScrollEnd={nativeEventLogger('momentumScrollEnd')}
|
|
15
|
+
onScrollToTop={nativeEventLogger('scrollToTop')}
|
|
16
|
+
onContentSizeChange={customEventLogger('contentSizeChange')}
|
|
17
|
+
>
|
|
18
|
+
<Text style={styles.text}>
|
|
19
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
20
|
+
tempor incididunt ut labore et dolore magna aliqua. Gravida neque
|
|
21
|
+
convallis a cras semper auctor neque. Ultrices in iaculis nunc sed augue
|
|
22
|
+
lacus. Vulputate ut pharetra sit amet aliquam id. Eget sit amet tellus
|
|
23
|
+
cras adipiscing enim. Velit aliquet sagittis id consectetur purus ut
|
|
24
|
+
faucibus pulvinar.
|
|
25
|
+
</Text>
|
|
26
|
+
<Text style={styles.text}>
|
|
27
|
+
Eget gravida cum sociis natoque penatibus. Nunc sed blandit libero
|
|
28
|
+
volutpat sed cras. Aliquet bibendum enim facilisis gravida neque
|
|
29
|
+
convallis a cras. Euismod nisi porta lorem mollis aliquam. Consequat
|
|
30
|
+
mauris nunc congue nisi vitae suscipit tellus. Mauris pellentesque
|
|
31
|
+
pulvinar pellentesque habitant morbi tristique. Nulla aliquet enim
|
|
32
|
+
tortor at auctor.
|
|
33
|
+
</Text>
|
|
34
|
+
<Text style={styles.text}>
|
|
35
|
+
A condimentum vitae sapien pellentesque. Quis eleifend quam adipiscing
|
|
36
|
+
vitae. Elit ut aliquam purus sit amet luctus venenatis. Id faucibus nisl
|
|
37
|
+
tincidunt eget nullam non nisi est. Nunc non blandit massa enim nec dui
|
|
38
|
+
nunc. Urna nec tincidunt praesent semper feugiat nibh. Malesuada fames
|
|
39
|
+
ac turpis egestas maecenas. Viverra nibh cras pulvinar mattis nunc sed
|
|
40
|
+
blandit.
|
|
41
|
+
</Text>
|
|
42
|
+
<Text style={styles.text}>
|
|
43
|
+
Molestie nunc non blandit massa enim nec dui nunc. Velit laoreet id
|
|
44
|
+
donec ultrices tincidunt arcu. Imperdiet nulla malesuada pellentesque
|
|
45
|
+
elit eget. Id neque aliquam vestibulum morbi blandit cursus. Ut
|
|
46
|
+
tristique et egestas quis. Nisl nunc mi ipsum faucibus vitae aliquet nec
|
|
47
|
+
ullamcorper sit. Cursus mattis molestie a iaculis at erat.
|
|
48
|
+
</Text>
|
|
49
|
+
<Text style={styles.text}>
|
|
50
|
+
Tincidunt arcu non sodales neque sodales ut etiam. Ultrices dui sapien
|
|
51
|
+
eget mi proin sed. Metus vulputate eu scelerisque felis. In pellentesque
|
|
52
|
+
massa placerat duis ultricies lacus sed turpis. Id leo in vitae turpis
|
|
53
|
+
massa sed elementum.
|
|
54
|
+
</Text>
|
|
55
|
+
</ScrollView>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const styles = StyleSheet.create({
|
|
60
|
+
text: {
|
|
61
|
+
paddingHorizontal: 20,
|
|
62
|
+
paddingTop: 20,
|
|
63
|
+
fontSize: 24,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View, SectionList } from 'react-native';
|
|
3
|
+
import { customEventLogger, nativeEventLogger } from '../utils/helpers';
|
|
4
|
+
|
|
5
|
+
interface SectionData {
|
|
6
|
+
title: string;
|
|
7
|
+
data: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const sections: SectionData[] = [
|
|
11
|
+
{
|
|
12
|
+
title: 'Main dishes',
|
|
13
|
+
data: [
|
|
14
|
+
'Pizza',
|
|
15
|
+
'Burger',
|
|
16
|
+
'Risotto',
|
|
17
|
+
'Pasta',
|
|
18
|
+
'Fish',
|
|
19
|
+
'Chicken',
|
|
20
|
+
'Beef',
|
|
21
|
+
'Dumplings',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: 'Sides',
|
|
26
|
+
data: [
|
|
27
|
+
'French Fries',
|
|
28
|
+
'Onion Rings',
|
|
29
|
+
'Fried Shrimps',
|
|
30
|
+
'Potatoes',
|
|
31
|
+
'Salad',
|
|
32
|
+
'Garlic Bread',
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'Drinks',
|
|
37
|
+
data: ['Water', 'Coke', 'Beer', 'Tea', 'Coffee', 'Soda', 'Matcha'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: 'Desserts',
|
|
41
|
+
data: ['Cheese Cake', 'Ice Cream', 'Chocolate', 'Cookies', 'Fruits'],
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
export function SectionListEvents() {
|
|
46
|
+
const renderSectionHeader = ({ section }: { section: SectionData }) => (
|
|
47
|
+
<Text style={styles.header}>{section.title}</Text>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const renderItem = ({ item }: { item: string }) => (
|
|
51
|
+
<View style={styles.item}>
|
|
52
|
+
<Text style={styles.title}>{item}</Text>
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<SectionList
|
|
58
|
+
sections={sections}
|
|
59
|
+
keyExtractor={(item, index) => item + index}
|
|
60
|
+
renderSectionHeader={renderSectionHeader}
|
|
61
|
+
renderItem={renderItem}
|
|
62
|
+
contentInsetAdjustmentBehavior="scrollableAxes"
|
|
63
|
+
scrollEventThrottle={150}
|
|
64
|
+
onScroll={nativeEventLogger('scroll')}
|
|
65
|
+
onScrollBeginDrag={nativeEventLogger('scrollBeginDrag')}
|
|
66
|
+
onScrollEndDrag={nativeEventLogger('scrollEndDrag')}
|
|
67
|
+
onMomentumScrollBegin={nativeEventLogger('momentumScrollBegin')}
|
|
68
|
+
onMomentumScrollEnd={nativeEventLogger('momentumScrollEnd')}
|
|
69
|
+
onScrollToTop={nativeEventLogger('scrollToTop')}
|
|
70
|
+
onEndReached={customEventLogger('endReached')}
|
|
71
|
+
onContentSizeChange={customEventLogger('contentSizeChange')}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const styles = StyleSheet.create({
|
|
77
|
+
header: {
|
|
78
|
+
paddingVertical: 8,
|
|
79
|
+
paddingHorizontal: 16,
|
|
80
|
+
backgroundColor: 'white',
|
|
81
|
+
fontSize: 24,
|
|
82
|
+
},
|
|
83
|
+
item: {
|
|
84
|
+
paddingVertical: 16,
|
|
85
|
+
paddingHorizontal: 16,
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
title: {
|
|
89
|
+
fontSize: 20,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StyleSheet, SafeAreaView, TextInput, Pressable } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const handlePressIn = buildEventLogger('TextInput.pressIn');
|
|
6
|
-
const handlePressOut = buildEventLogger('TextInput.pressOut');
|
|
7
|
-
const handleFocus = buildEventLogger('TextInput.focus');
|
|
8
|
-
const handleBlur = buildEventLogger('TextInput.blur');
|
|
9
|
-
const handleChange = buildEventLogger('TextInput.change');
|
|
10
|
-
const handleSubmitEditing = buildEventLogger('TextInput.submitEditing');
|
|
11
|
-
|
|
12
|
-
const handlePressablePress = buildEventLogger('Pressable.press');
|
|
3
|
+
import { nativeEventLogger } from '../utils/helpers';
|
|
13
4
|
|
|
14
5
|
export function TextInputEventPropagation() {
|
|
15
6
|
const [value, setValue] = React.useState('');
|
|
@@ -21,18 +12,15 @@ export function TextInputEventPropagation() {
|
|
|
21
12
|
|
|
22
13
|
return (
|
|
23
14
|
<SafeAreaView style={styles.container}>
|
|
24
|
-
<Pressable onPress={
|
|
15
|
+
<Pressable onPress={nativeEventLogger('Pressable.press')}>
|
|
25
16
|
<TextInput
|
|
26
17
|
style={styles.textInput}
|
|
27
18
|
value={value}
|
|
28
19
|
editable={true}
|
|
29
20
|
onChangeText={handleChangeText}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onBlur={handleBlur}
|
|
34
|
-
onChange={handleChange}
|
|
35
|
-
onSubmitEditing={handleSubmitEditing}
|
|
21
|
+
onChange={nativeEventLogger('TextInput.change')}
|
|
22
|
+
onPressIn={nativeEventLogger('TextInput.pressIn')}
|
|
23
|
+
onPressOut={nativeEventLogger('TextInput.pressOut')}
|
|
36
24
|
/>
|
|
37
25
|
</Pressable>
|
|
38
26
|
</SafeAreaView>
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StyleSheet, SafeAreaView, TextInput } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const handlePressIn = buildEventLogger('pressIn');
|
|
6
|
-
const handlePressOut = buildEventLogger('pressOut');
|
|
7
|
-
const handleFocus = buildEventLogger('focus');
|
|
8
|
-
const handleBlur = buildEventLogger('blur');
|
|
9
|
-
const handleChange = buildEventLogger('change');
|
|
10
|
-
const handleEndEditing = buildEventLogger('endEditing');
|
|
11
|
-
const handleSubmitEditing = buildEventLogger('submitEditing');
|
|
12
|
-
const handleKeyPress = buildEventLogger('keyPress');
|
|
13
|
-
const handleTextInput = buildEventLogger('textInput');
|
|
14
|
-
const handleSelectionChange = buildEventLogger('selectionChange');
|
|
15
|
-
const handleContentSizeChange = buildEventLogger('contentSizeChange');
|
|
3
|
+
import { nativeEventLogger, logEvent } from '../utils/helpers';
|
|
16
4
|
|
|
17
5
|
export function TextInputEvents() {
|
|
18
6
|
const [value, setValue] = React.useState('');
|
|
19
7
|
|
|
20
8
|
const handleChangeText = (value: string) => {
|
|
21
9
|
setValue(value);
|
|
22
|
-
|
|
10
|
+
logEvent('changeText', value);
|
|
23
11
|
};
|
|
24
12
|
|
|
25
13
|
return (
|
|
@@ -29,17 +17,17 @@ export function TextInputEvents() {
|
|
|
29
17
|
value={value}
|
|
30
18
|
editable={true}
|
|
31
19
|
onChangeText={handleChangeText}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
onChange={nativeEventLogger('change')}
|
|
21
|
+
onKeyPress={nativeEventLogger('keyPress')}
|
|
22
|
+
onEndEditing={nativeEventLogger('endEditing')}
|
|
23
|
+
onSubmitEditing={nativeEventLogger('submitEditing')}
|
|
24
|
+
onTextInput={nativeEventLogger('textInput')}
|
|
25
|
+
onSelectionChange={nativeEventLogger('selectionChange')}
|
|
26
|
+
onContentSizeChange={nativeEventLogger('contentSizeChange')}
|
|
27
|
+
onFocus={nativeEventLogger('focus')}
|
|
28
|
+
onBlur={nativeEventLogger('blur')}
|
|
29
|
+
onPressIn={nativeEventLogger('pressIn')}
|
|
30
|
+
onPressOut={nativeEventLogger('pressOut')}
|
|
43
31
|
/>
|
|
44
32
|
</SafeAreaView>
|
|
45
33
|
);
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { NativeSyntheticEvent } from 'react-native/types';
|
|
2
2
|
|
|
3
|
-
export function
|
|
3
|
+
export function nativeEventLogger(name: string) {
|
|
4
4
|
return (event: NativeSyntheticEvent<unknown>) => {
|
|
5
|
-
|
|
6
|
-
console.log(`Event: ${name}`, eventData);
|
|
5
|
+
logEvent(name, event?.nativeEvent);
|
|
7
6
|
};
|
|
8
7
|
}
|
|
8
|
+
|
|
9
|
+
export function customEventLogger(name: string) {
|
|
10
|
+
return (...args: unknown[]) => {
|
|
11
|
+
logEvent(name, ...args);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function logEvent(name: string, ...args: unknown[]) {
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
console.log(`Event: ${name}`, ...args);
|
|
18
|
+
}
|