From ef55e6fc47b9adc83afc6ddcae92d7461013512b Mon Sep 17 00:00:00 2001 From: Marlene Cota <1422161+marlenecota@users.noreply.github.com> Date: Tue, 21 May 2024 12:20:52 -0700 Subject: [PATCH] Integration 04/20/24 (03a51da72) (#13255) * RN Integration 04/20 * Change files * add captureStackTrace * add PixelRatio example copy override * add PixelRatioExample.js * snapshots for PixelRatio * return empty StackFrame instead of nullptr * add email to change files --- ...-c75f8136-1a7a-4073-8eea-d9d2cac625c3.json | 7 + ...-507c6778-bf67-4ec4-97f7-8d55c041d566.json | 7 + ...-1f79d48e-175e-43c5-ade0-1c62a2b7ebc0.json | 7 + ...-021415fa-fafb-4738-ad99-2b271fcf623c.json | 7 + .../react-native-win32-tester/overrides.json | 4 +- .../react-native-win32-tester/package.json | 4 +- .../src/js/utils/RNTesterList.win32.js | 12 + .../react-native-win32/.flowconfig | 2 +- .../react-native-win32/overrides.json | 4 +- .../react-native-win32/package.json | 22 +- .../automation-channel/package.json | 2 +- .../tester/overrides.json | 4 +- .../@react-native-windows/tester/package.json | 4 +- .../src/js/utils/RNTesterList.windows.js | 12 + .../@react-native/monorepo/overrides.json | 4 +- packages/@react-native/monorepo/package.json | 16 +- .../tester/js/components/RNTOption.js | 7 +- .../tester/js/components/RNTTestDetails.js | 8 +- .../Accessibility/AccessibilityExample.js | 1741 +++++++++-------- .../ComposeAnimationsWithEasingExample.js | 6 +- .../js/examples/Animated/ComposingExample.js | 8 +- .../Animated/ContinuousInteractionsExample.js | 14 +- .../js/examples/Animated/EasingExample.js | 7 +- .../Animated/TransformStylesExample.js | 8 +- .../Animated/utils/ToggleNativeDriver.js | 4 +- .../RNTesterPlatformTestEventRecorder.js | 1 + .../examples/PixelRatio/PixelRatioExample.js | 201 ++ .../tester/js/utils/RNTesterList.android.js | 5 + .../tester/js/utils/RNTesterList.ios.js | 4 + packages/@react-native/tester/overrides.json | 21 +- packages/@react-native/tester/package.json | 4 +- .../babel-react-native-config/package.json | 4 +- .../@rnw-scripts/eslint-config/package.json | 2 +- .../metro-dev-config/package.json | 2 +- packages/e2e-test-app-fabric/package.json | 7 +- .../__snapshots__/HomeUIADump.test.ts.snap | 258 ++- .../__snapshots__/snapshotPages.test.js.snap | 929 +++++++-- packages/e2e-test-app/package.json | 4 +- packages/integration-test-app/package.json | 4 +- packages/playground/package.json | 4 +- packages/sample-app-fabric/package.json | 4 +- packages/sample-apps/package.json | 4 +- vnext/.flowconfig | 2 +- .../cxxreact/JSExecutor.cpp | 6 + .../cxxreact/JSExecutor.h | 17 + vnext/Shared/HermesRuntimeHolder.cpp | 6 + vnext/Shared/HermesRuntimeHolder.h | 3 + vnext/Shared/Shared.vcxitems | 3 - .../NativeReactNativeFeatureFlagsSpec.g.h | 16 +- vnext/codegen/NativeUIManagerSpec.g.h | 22 +- vnext/codegen/rnwcoreJSI-generated.cpp | 24 +- vnext/codegen/rnwcoreJSI.h | 27 +- vnext/overrides.json | 6 +- vnext/package.json | 22 +- yarn.lock | 178 +- 55 files changed, 2504 insertions(+), 1207 deletions(-) create mode 100644 change/@office-iss-react-native-win32-c75f8136-1a7a-4073-8eea-d9d2cac625c3.json create mode 100644 change/@react-native-windows-automation-channel-507c6778-bf67-4ec4-97f7-8d55c041d566.json create mode 100644 change/@rnw-scripts-eslint-config-1f79d48e-175e-43c5-ade0-1c62a2b7ebc0.json create mode 100644 change/react-native-windows-021415fa-fafb-4738-ad99-2b271fcf623c.json create mode 100644 packages/@react-native/tester/js/examples/PixelRatio/PixelRatioExample.js diff --git a/change/@office-iss-react-native-win32-c75f8136-1a7a-4073-8eea-d9d2cac625c3.json b/change/@office-iss-react-native-win32-c75f8136-1a7a-4073-8eea-d9d2cac625c3.json new file mode 100644 index 0000000000..5193d9ad15 --- /dev/null +++ b/change/@office-iss-react-native-win32-c75f8136-1a7a-4073-8eea-d9d2cac625c3.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "RN Integration 04/20", + "packageName": "@office-iss/react-native-win32", + "email": "1422161+marlenecota@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/@react-native-windows-automation-channel-507c6778-bf67-4ec4-97f7-8d55c041d566.json b/change/@react-native-windows-automation-channel-507c6778-bf67-4ec4-97f7-8d55c041d566.json new file mode 100644 index 0000000000..93bd1ba628 --- /dev/null +++ b/change/@react-native-windows-automation-channel-507c6778-bf67-4ec4-97f7-8d55c041d566.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "RN Integration 04/20", + "packageName": "@react-native-windows/automation-channel", + "email": "1422161+marlenecota@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/@rnw-scripts-eslint-config-1f79d48e-175e-43c5-ade0-1c62a2b7ebc0.json b/change/@rnw-scripts-eslint-config-1f79d48e-175e-43c5-ade0-1c62a2b7ebc0.json new file mode 100644 index 0000000000..96936206c5 --- /dev/null +++ b/change/@rnw-scripts-eslint-config-1f79d48e-175e-43c5-ade0-1c62a2b7ebc0.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "RN Integration 04/20", + "packageName": "@rnw-scripts/eslint-config", + "email": "1422161+marlenecota@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/react-native-windows-021415fa-fafb-4738-ad99-2b271fcf623c.json b/change/react-native-windows-021415fa-fafb-4738-ad99-2b271fcf623c.json new file mode 100644 index 0000000000..1427b07e24 --- /dev/null +++ b/change/react-native-windows-021415fa-fafb-4738-ad99-2b271fcf623c.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "RN Integration 04/20", + "packageName": "react-native-windows", + "email": "1422161+marlenecota@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/@office-iss/react-native-win32-tester/overrides.json b/packages/@office-iss/react-native-win32-tester/overrides.json index c5f381ea38..52b320603e 100644 --- a/packages/@office-iss/react-native-win32-tester/overrides.json +++ b/packages/@office-iss/react-native-win32-tester/overrides.json @@ -5,7 +5,7 @@ "excludePatterns": [ "src/js/examples-win32/**" ], - "baseVersion": "0.75.0-nightly-20240413-1b152f6ec", + "baseVersion": "0.75.0-nightly-20240420-03a51da72", "overrides": [ { "type": "patch", @@ -42,7 +42,7 @@ "type": "derived", "file": "src/js/utils/RNTesterList.win32.js", "baseFile": "packages/rn-tester/js/utils/RNTesterList.android.js", - "baseHash": "c40d0a03a89b9017cbb08a0449d5a0c32cadc5f2" + "baseHash": "17abcd7c97a27d4d970d27c1449107222ffb6c85" } ] } \ No newline at end of file diff --git a/packages/@office-iss/react-native-win32-tester/package.json b/packages/@office-iss/react-native-win32-tester/package.json index 601a7ae4ab..86ba39bb9c 100644 --- a/packages/@office-iss/react-native-win32-tester/package.json +++ b/packages/@office-iss/react-native-win32-tester/package.json @@ -19,7 +19,7 @@ "peerDependencies": { "@office-iss/react-native-win32": "^0.0.0-canary.246", "react": "18.0.0", - "react-native": "0.75.0-nightly-20240413-1b152f6ec" + "react-native": "0.75.0-nightly-20240420-03a51da72" }, "devDependencies": { "@office-iss/react-native-win32": "^0.0.0-canary.246", @@ -30,7 +30,7 @@ "@types/node": "^18.0.0", "eslint": "^8.19.0", "just-scripts": "^1.3.3", - "react-native": "0.75.0-nightly-20240413-1b152f6ec", + "react-native": "0.75.0-nightly-20240420-03a51da72", "react-native-platform-override": "^1.9.33", "typescript": "5.0.4" }, diff --git a/packages/@office-iss/react-native-win32-tester/src/js/utils/RNTesterList.win32.js b/packages/@office-iss/react-native-win32-tester/src/js/utils/RNTesterList.win32.js index ebf102266a..e06e4d8b56 100644 --- a/packages/@office-iss/react-native-win32-tester/src/js/utils/RNTesterList.win32.js +++ b/packages/@office-iss/react-native-win32-tester/src/js/utils/RNTesterList.win32.js @@ -260,6 +260,18 @@ const APIs: Array = ([ category: 'Basic', module: require('../examples/PanResponder/PanResponderExample'), }, + { + key: 'PixelRatio', + category: 'UI', + module: require('../examples/PixelRatio/PixelRatioExample'), + }, + /* + { + key: 'PermissionsExampleAndroid', + category: 'Android', + module: require('../examples/PermissionsAndroid/PermissionsExample'), + }, + */ { key: 'PlatformColorExample', category: 'UI', diff --git a/packages/@office-iss/react-native-win32/.flowconfig b/packages/@office-iss/react-native-win32/.flowconfig index 18408d0005..1ed9dddf9b 100644 --- a/packages/@office-iss/react-native-win32/.flowconfig +++ b/packages/@office-iss/react-native-win32/.flowconfig @@ -153,4 +153,4 @@ untyped-import untyped-type-import [version] -^0.233.0 +^0.234.0 diff --git a/packages/@office-iss/react-native-win32/overrides.json b/packages/@office-iss/react-native-win32/overrides.json index d96973e744..52850d1eff 100644 --- a/packages/@office-iss/react-native-win32/overrides.json +++ b/packages/@office-iss/react-native-win32/overrides.json @@ -7,13 +7,13 @@ "**/__snapshots__/**", "src-win/rntypes/**" ], - "baseVersion": "0.75.0-nightly-20240413-1b152f6ec", + "baseVersion": "0.75.0-nightly-20240420-03a51da72", "overrides": [ { "type": "derived", "file": ".flowconfig", "baseFile": ".flowconfig", - "baseHash": "207887dce4d232e4ded4dbeefe4188766b24144a" + "baseHash": "4f8e1f39d8ed29d7d0e21455cac407d352a6824d" }, { "type": "derived", diff --git a/packages/@office-iss/react-native-win32/package.json b/packages/@office-iss/react-native-win32/package.json index 0060466df4..db8ccfc2c9 100644 --- a/packages/@office-iss/react-native-win32/package.json +++ b/packages/@office-iss/react-native-win32/package.json @@ -30,13 +30,13 @@ "@react-native-community/cli-platform-android": "14.0.0-alpha.2", "@react-native-community/cli-platform-ios": "14.0.0-alpha.2", "@react-native/assets": "1.0.0", - "@react-native/assets-registry": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/codegen": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/community-cli-plugin": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/gradle-plugin": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/js-polyfills": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/normalize-colors": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/virtualized-lists": "0.75.0-nightly-20240413-1b152f6ec", + "@react-native/assets-registry": "0.75.0-nightly-20240420-03a51da72", + "@react-native/codegen": "0.75.0-nightly-20240420-03a51da72", + "@react-native/community-cli-plugin": "0.75.0-nightly-20240420-03a51da72", + "@react-native/gradle-plugin": "0.75.0-nightly-20240420-03a51da72", + "@react-native/js-polyfills": "0.75.0-nightly-20240420-03a51da72", + "@react-native/normalize-colors": "0.75.0-nightly-20240420-03a51da72", + "@react-native/virtualized-lists": "0.75.0-nightly-20240420-03a51da72", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", @@ -56,7 +56,7 @@ "pretty-format": "^26.5.2", "promise": "^8.3.0", "react-clone-referenced-element": "^1.0.1", - "react-devtools-core": "^5.0.2", + "react-devtools-core": "5.1.0", "react-refresh": "^0.14.0", "react-shallow-renderer": "^16.15.0", "regenerator-runtime": "^0.13.2", @@ -70,7 +70,7 @@ "devDependencies": { "@babel/core": "^7.20.0", "@babel/eslint-parser": "^7.20.0", - "@react-native/metro-config": "0.75.0-nightly-20240413-1b152f6ec", + "@react-native/metro-config": "0.75.0-nightly-20240420-03a51da72", "@rnw-scripts/babel-react-native-config": "0.0.0", "@rnw-scripts/eslint-config": "1.2.16", "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.20", @@ -86,14 +86,14 @@ "just-scripts": "^1.3.3", "prettier": "2.8.8", "react": "18.2.0", - "react-native": "0.75.0-nightly-20240413-1b152f6ec", + "react-native": "0.75.0-nightly-20240420-03a51da72", "react-native-platform-override": "^1.9.33", "typescript": "5.0.4" }, "peerDependencies": { "@types/react": "^18.2.6", "react": "18.2.0", - "react-native": "0.75.0-nightly-20240413-1b152f6ec" + "react-native": "0.75.0-nightly-20240420-03a51da72" }, "beachball": { "defaultNpmTag": "canary", diff --git a/packages/@react-native-windows/automation-channel/package.json b/packages/@react-native-windows/automation-channel/package.json index 8c79aeb1b2..f70f07d359 100644 --- a/packages/@react-native-windows/automation-channel/package.json +++ b/packages/@react-native-windows/automation-channel/package.json @@ -31,7 +31,7 @@ "just-scripts": "^1.3.2", "prettier": "2.8.8", "react": "18.2.0", - "react-native": "0.75.0-nightly-20240413-1b152f6ec", + "react-native": "0.75.0-nightly-20240420-03a51da72", "react-native-windows": "^0.0.0-canary.817", "typescript": "5.0.4" }, diff --git a/packages/@react-native-windows/tester/overrides.json b/packages/@react-native-windows/tester/overrides.json index a0a38e65bf..01d251fb53 100644 --- a/packages/@react-native-windows/tester/overrides.json +++ b/packages/@react-native-windows/tester/overrides.json @@ -5,7 +5,7 @@ "excludePatterns": [ "src/js/examples-win/**" ], - "baseVersion": "0.75.0-nightly-20240413-1b152f6ec", + "baseVersion": "0.75.0-nightly-20240420-03a51da72", "overrides": [ { "type": "derived", @@ -78,7 +78,7 @@ "type": "derived", "file": "src/js/utils/RNTesterList.windows.js", "baseFile": "packages/rn-tester/js/utils/RNTesterList.android.js", - "baseHash": "c40d0a03a89b9017cbb08a0449d5a0c32cadc5f2" + "baseHash": "17abcd7c97a27d4d970d27c1449107222ffb6c85" } ] } \ No newline at end of file diff --git a/packages/@react-native-windows/tester/package.json b/packages/@react-native-windows/tester/package.json index e7c73ed429..6fc66adec0 100644 --- a/packages/@react-native-windows/tester/package.json +++ b/packages/@react-native-windows/tester/package.json @@ -18,7 +18,7 @@ "peerDependencies": { "@react-native-picker/picker": "2.4.10", "react": "18.0.0", - "react-native": "0.75.0-nightly-20240413-1b152f6ec", + "react-native": "0.75.0-nightly-20240420-03a51da72", "react-native-windows": "^0.0.0-canary.817", "react-native-xaml": "^0.0.78" }, @@ -31,7 +31,7 @@ "@types/node": "^18.0.0", "eslint": "^8.19.0", "just-scripts": "^1.3.3", - "react-native": "0.75.0-nightly-20240413-1b152f6ec", + "react-native": "0.75.0-nightly-20240420-03a51da72", "react-native-platform-override": "^1.9.33", "react-native-windows": "^0.0.0-canary.817", "typescript": "5.0.4" diff --git a/packages/@react-native-windows/tester/src/js/utils/RNTesterList.windows.js b/packages/@react-native-windows/tester/src/js/utils/RNTesterList.windows.js index 00162c3495..8feae6ffcb 100644 --- a/packages/@react-native-windows/tester/src/js/utils/RNTesterList.windows.js +++ b/packages/@react-native-windows/tester/src/js/utils/RNTesterList.windows.js @@ -346,6 +346,18 @@ const APIs: Array = ([ category: 'Basic', module: require('../examples/PanResponder/PanResponderExample'), }, + { + key: 'PixelRatio', + category: 'UI', + module: require('../examples/PixelRatio/PixelRatioExample'), + }, + /* + { + key: 'PermissionsExampleAndroid', + category: 'Android', + module: require('../examples/PermissionsAndroid/PermissionsExample'), + }, + */ { key: 'PlatformColorExample', category: 'UI', diff --git a/packages/@react-native/monorepo/overrides.json b/packages/@react-native/monorepo/overrides.json index 1add54917d..558cbe8263 100644 --- a/packages/@react-native/monorepo/overrides.json +++ b/packages/@react-native/monorepo/overrides.json @@ -1,11 +1,11 @@ { - "baseVersion": "0.75.0-nightly-20240413-1b152f6ec", + "baseVersion": "0.75.0-nightly-20240420-03a51da72", "overrides": [ { "type": "patch", "file": "package.json", "baseFile": "package.json", - "baseHash": "81f7183581b4f3efc83807acf9d13acf11cbbc6e" + "baseHash": "d3015ceabe0cf60dff4ad9eb59b102608b40c8ca" } ] } \ No newline at end of file diff --git a/packages/@react-native/monorepo/package.json b/packages/@react-native/monorepo/package.json index 799a1109e7..56a06652b9 100644 --- a/packages/@react-native/monorepo/package.json +++ b/packages/@react-native/monorepo/package.json @@ -2,14 +2,7 @@ "name": "@react-native/monorepo", "private": true, "version": "1000.0.0", - "description": "A framework for building native apps using React", "license": "MIT", - "repository": "github:facebook/react-native", - "types": "types", - "jest-junit": { - "outputDirectory": "reports/junit", - "outputName": "js-test-results.xml" - }, "scripts": { "android": "cd packages/rn-tester && npm run android", "build-android": "./gradlew :packages:react-native:ReactAndroid:build", @@ -42,9 +35,6 @@ "packages/*", "tools/*" ], - "peerDependencies": { - "react": "18.2.0" - }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/eslint-parser": "^7.20.0", @@ -55,8 +45,8 @@ "@definitelytyped/dtslint": "^0.0.127", "@jest/create-cache-key-function": "^29.6.3", "@pkgjs/parseargs": "^0.11.0", - "@react-native/metro-babel-transformer": "0.75.0-nightly-20240413-1b152f6ec", - "@react-native/metro-config": "0.75.0-nightly-20240413-1b152f6ec", + "@react-native/metro-babel-transformer": "0.75.0-nightly-20240420-03a51da72", + "@react-native/metro-config": "0.75.0-nightly-20240420-03a51da72", "@tsconfig/node18": "1.0.1", "@types/react": "^18.2.6", "@typescript-eslint/parser": "^7.1.1", @@ -83,7 +73,7 @@ "eslint-plugin-redundant-undefined": "^0.4.0", "eslint-plugin-relay": "^1.8.3", "flow-api-translator": "0.20.1", - "flow-bin": "^0.233.0", + "flow-bin": "^0.234.0", "glob": "^7.1.1", "hermes-eslint": "0.20.0", "hermes-transform": "0.20.0", diff --git a/packages/@react-native/tester/js/components/RNTOption.js b/packages/@react-native/tester/js/components/RNTOption.js index 7d3d534277..0d92178524 100644 --- a/packages/@react-native/tester/js/components/RNTOption.js +++ b/packages/@react-native/tester/js/components/RNTOption.js @@ -49,6 +49,7 @@ export default function RNTOption(props: Props): React.Node { testID={props.testID}> - {props.label} + {props.label} ); @@ -70,16 +71,12 @@ const styles = StyleSheet.create({ pressed: { backgroundColor: 'rgba(100,215,255,.3)', }, - label: { - color: 'black', - }, selected: { backgroundColor: 'rgba(100,215,255,.3)', borderColor: 'rgba(100,215,255,.3)', }, disabled: {borderWidth: 0}, container: { - borderColor: 'rgba(0,0,0, 0.1)', borderWidth: 1, borderRadius: 16, padding: 6, diff --git a/packages/@react-native/tester/js/components/RNTTestDetails.js b/packages/@react-native/tester/js/components/RNTTestDetails.js index 1b5d61e9bc..7ca2bf5206 100644 --- a/packages/@react-native/tester/js/components/RNTTestDetails.js +++ b/packages/@react-native/tester/js/components/RNTTestDetails.js @@ -39,8 +39,12 @@ function RNTTestDetails({ )} {expect == null ? null : ( - Expectation - {expect} + + Expectation + + + {expect} + )} diff --git a/packages/@react-native/tester/js/examples/Accessibility/AccessibilityExample.js b/packages/@react-native/tester/js/examples/Accessibility/AccessibilityExample.js index bd14a80134..f7e92706c4 100644 --- a/packages/@react-native/tester/js/examples/Accessibility/AccessibilityExample.js +++ b/packages/@react-native/tester/js/examples/Accessibility/AccessibilityExample.js @@ -13,6 +13,8 @@ import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import type {EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter'; +import {RNTesterThemeContext} from '../../components/RNTesterTheme'; + const RNTesterBlock = require('../../components/RNTesterBlock'); const checkImageSource = require('./check.png'); const mixedCheckboxImageSource = require('./mixed.png'); @@ -104,180 +106,214 @@ const styles = StyleSheet.create({ class AccessibilityExample extends React.Component<{}> { render(): React.Node { return ( - - - - Text's accessibilityLabel is the raw text itself unless it is set - explicitly. - - - - - - This text component's accessibilityLabel is set explicitly. - - - - - - This is text one. - This is text two. - - - - - - This is text one. - This is text two. - - - - - - This is text one. - This is text two. - - - - - - - This view's children are hidden from the accessibility tree - - - - - {/* Android screen readers will say the accessibility hint instead of the text - since the view doesn't have a label. */} - - - This is text one. - This is text two. - - - - - - This is text one. - This is text two. - - - - - This is a title. - - - - This is a title. - - - - Alert.alert('Link has been clicked!')} - accessibilityRole="link"> - - Click me - - - - - - Alert.alert('Button has been pressed!')} - accessibilityRole="button"> - Click me - - - - - Alert.alert('Button has been pressed!')} - accessibilityRole="button" - accessibilityState={{disabled: true}} - disabled={true}> - - - I am disabled. Clicking me will not trigger any action. + + {theme => ( + + + + Text's accessibilityLabel is the raw text itself unless it is + set explicitly. - - - + - - Alert.alert('Disabled Button has been pressed!')} - accessibilityLabel={'You are pressing Disabled TouchableOpacity'} - accessibilityState={{disabled: true}}> - - - I am disabled. Clicking me will not trigger any action. + + + This text component's accessibilityLabel is set explicitly. - - - - - - This view is selected and disabled. - - + - - - Accessible view with label, hint, role, and state - - + + + This is text one. + This is text two. + + - - - Accessible view with label, hint, role, and state - - + + + This is text one. + This is text two. + + - - - Mail Address - - First Name - + + + This is text one. + This is text two. + + + + + + + This view's children are hidden from the accessibility tree + + + + + {/* Android screen readers will say the accessibility hint instead of the text + since the view doesn't have a label. */} + + + This is text one. + This is text two. + + + + + + This is text one. + This is text two. + + + + + + This is a title. + + + + + + This is a title. + + + + + Alert.alert('Link has been clicked!')} + accessibilityRole="link"> + + + Click me + + + + + + + Alert.alert('Button has been pressed!')} + accessibilityRole="button"> + Click me + + + + + Alert.alert('Button has been pressed!')} + accessibilityRole="button" + accessibilityState={{disabled: true}} + disabled={true}> + + + I am disabled. Clicking me will not trigger any action. + + + + + + + Alert.alert('Disabled Button has been pressed!')} + accessibilityLabel={ + 'You are pressing Disabled TouchableOpacity' + } + accessibilityState={{disabled: true}}> + + + I am disabled. Clicking me will not trigger any action. + + + + + + + + This view is selected and disabled. + + + + + + + + Accessible view with label, hint, role, and state + + + + + + + + Accessible view with label, hint, role, and state + + + + + + + + Mail Address + + + + First Name + + + + + + + + Enable Notifications + + + + - - - - Enable Notifications - - - - + )} + ); } } @@ -285,134 +321,170 @@ class AccessibilityExample extends React.Component<{}> { class AutomaticContentGrouping extends React.Component<{}> { render(): React.Node { return ( - - - - - - Text number 1 with a role - - Text number 2 - - - - - - { - switch (event.nativeEvent.actionName) { - case 'cut': - Alert.alert('Alert', 'cut action success'); - break; - case 'copy': - Alert.alert('Alert', 'copy action success'); - break; - case 'paste': - Alert.alert('Alert', 'paste action success'); - break; - } - }} - accessibilityRole="button"> - - Text number 1 - - Text number 2Text number 3 - - - - - - - - - Text number 1 - - - - - - - - - Text number 1 + + {theme => ( + + console.warn('onPress child')} - accessible={false} - accessibilityLabel="this is my label" - accessibilityRole="image" - accessibilityState={{disabled: true}} - accessibilityValue={{text: 'this is the accessibility value'}}> - Text number 3 + accessible={true} + accessibilityRole="button"> + + + Text number 1 with a role + + + Text number 2 + + - + + + + { + switch (event.nativeEvent.actionName) { + case 'cut': + Alert.alert('Alert', 'cut action success'); + break; + case 'copy': + Alert.alert('Alert', 'copy action success'); + break; + case 'paste': + Alert.alert('Alert', 'paste action success'); + break; + } + }} + accessibilityRole="button"> + + + Text number 1 + + + Text number 2Text number 3 + + + + + + + + + Text number 1 + + + + + + + + + + Text number 1 + + console.warn('onPress child')} + accessible={false} + accessibilityLabel="this is my label" + accessibilityRole="image" + accessibilityState={{disabled: true}} + accessibilityValue={{ + text: 'this is the accessibility value', + }}> + + Text number 3 + + + + + + + + + + + + + + + + Text number 2 + + Text number 3Text number 4 + + + + + + + console.warn('onPress child')} + accessible={true} + accessibilityRole="button"> + + + + + + + + + + + - - - - - - - - - - - - Text number 2 - - Text number 3Text number 4 - - - - - - - console.warn('onPress child')} - accessible={true} - accessibilityRole="button"> - - - - - - - - - - - - + )} + ); } } @@ -444,14 +516,20 @@ class CheckboxExample extends React.Component< render(): React.Node { return ( - - Checkbox example - + + {theme => ( + + + Checkbox example + + + )} + ); } } @@ -476,14 +554,20 @@ class SwitchExample extends React.Component< render(): React.Node { return ( - - Switch example - + + {theme => ( + + + Switch example + + + )} + ); } } @@ -589,13 +673,19 @@ class ExpandableElementExample extends React.Component< render(): React.Node { return ( - - Expandable element example - + + {theme => ( + + + Expandable element example + + + )} + ); } } @@ -666,55 +756,59 @@ class NestedCheckBox extends React.Component< render(): React.Node { return ( - - - - Meat - - - - Beef - - - - Bacon - - + + {theme => ( + + + + Meat + + + + Beef + + + + Bacon + + + )} + ); } } @@ -732,156 +826,210 @@ class AccessibilityRoleAndStateExample extends React.Component<{}> { ]; return ( - - - - {content} - - - - - {content} - - - - - {content} - - - - - - Alert example - - - - Combobox example - - - Menu example - - - Menu bar example - - - Menu item example - - - Progress bar example - - - Radio button example - - - Radio group example - - - Scrollbar example - - - Spin button example - - - - Tab example - - - Tab list example - - - Timer example - - - Toolbar example - - - State busy example - - - Drop Down List example - - - Pager example - - - Toggle Button example - - - Viewgroup example - - - Webview example - - - - Nested checkbox with delayed state change - + + {theme => ( + + + + + {content} + + + + + + + {content} + + + + + + + {content} + + + + + + + + Alert example + + + + + + Combobox example + + + + + Menu example + + + + + Menu bar example + + + + + Menu item example + + + + + Progress bar example + + + + + Radio button example + + + + + Radio group example + + + + + Scrollbar example + + + + + Spin button example + + + + + + Tab example + + + + + Tab list example + + + + + Timer example + + + + + Toolbar example + + + + + State busy example + + + + + Drop Down List example + + + + + Pager example + + + + + Toggle Button example + + + + + Viewgroup example + + + + + Webview example + + + + + + Nested checkbox with delayed state change + + + + - - + )} + ); } } @@ -889,138 +1037,150 @@ class AccessibilityRoleAndStateExample extends React.Component<{}> { class AccessibilityActionsExample extends React.Component<{}> { render(): React.Node { return ( - - - { - switch (event.nativeEvent.actionName) { - case 'activate': - Alert.alert('Alert', 'View is clicked'); - break; - } - }}> - Click me + + {theme => ( + + + { + switch (event.nativeEvent.actionName) { + case 'activate': + Alert.alert('Alert', 'View is clicked'); + break; + } + }}> + Click me + + + + + { + switch (event.nativeEvent.actionName) { + case 'cut': + Alert.alert('Alert', 'cut action success'); + break; + case 'copy': + Alert.alert('Alert', 'copy action success'); + break; + case 'paste': + Alert.alert('Alert', 'paste action success'); + break; + } + }}> + + This view supports many actions. + + + + + + { + switch (event.nativeEvent.actionName) { + case 'increment': + Alert.alert('Alert', 'increment action success'); + break; + case 'decrement': + Alert.alert('Alert', 'decrement action success'); + break; + } + }}> + Slider + + + + + { + switch (event.nativeEvent.actionName) { + case 'cut': + Alert.alert('Alert', 'cut action success'); + break; + case 'copy': + Alert.alert('Alert', 'copy action success'); + break; + case 'paste': + Alert.alert('Alert', 'paste action success'); + break; + } + }} + onPress={() => Alert.alert('Button has been pressed!')} + accessibilityRole="button"> + + + Click me + + + + + + +