@office-iss/react-native-win32 0.71.0-preview.2 → 0.71.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.
Files changed (99) hide show
  1. package/.flowconfig +2 -0
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +21 -5
  4. package/Libraries/Animated/Animated.d.ts +28 -0
  5. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +29 -0
  6. package/Libraries/Components/Button/ButtonWin32.Props.d.ts +2 -2
  7. package/Libraries/Components/Button/ButtonWin32.d.ts +1 -1
  8. package/Libraries/Components/Button/ButtonWin32.js +6 -4
  9. package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
  10. package/Libraries/Components/Pressable/Pressable.win32.js +0 -1
  11. package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
  12. package/Libraries/Components/Text/TextWin32.Props.d.ts +3 -9
  13. package/Libraries/Components/Text/TextWin32.Props.js.map +1 -1
  14. package/Libraries/Components/Text/TextWin32.d.ts +1 -1
  15. package/Libraries/Components/Text/TextWin32.js.map +1 -1
  16. package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +9 -9
  17. package/Libraries/Components/TextInput/TextInput.win32.js +1150 -154
  18. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +4 -4
  19. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  20. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +119 -16
  21. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +99 -24
  22. package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +2 -2
  23. package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
  24. package/Libraries/Components/Touchable/TouchableWin32.Types.d.ts +9 -9
  25. package/Libraries/Components/Touchable/TouchableWin32.js +5 -6
  26. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  27. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +29 -10
  28. package/Libraries/Components/View/Tests/ViewWin32Test.js +31 -51
  29. package/Libraries/Components/View/Tests/ViewWin32Test.js.map +1 -1
  30. package/Libraries/Components/View/ViewAccessibility.win32.d.ts +527 -0
  31. package/Libraries/Components/View/ViewAccessibility.win32.js +178 -0
  32. package/Libraries/Components/View/ViewPropTypes.win32.d.ts +372 -0
  33. package/Libraries/Components/View/ViewPropTypes.win32.js +23 -0
  34. package/Libraries/Components/View/ViewWin32.d.ts +30 -12
  35. package/Libraries/Components/View/ViewWin32.js +161 -71
  36. package/Libraries/Core/ReactNativeVersion.js +1 -1
  37. package/Libraries/Image/Image.win32.js +0 -1
  38. package/Libraries/Image/ImageSource.js +0 -2
  39. package/Libraries/Lists/FlatList.d.ts +1 -42
  40. package/Libraries/Lists/FlatList.js +1 -0
  41. package/Libraries/Lists/SectionList.d.ts +0 -42
  42. package/Libraries/Lists/VirtualizedList.d.ts +31 -1
  43. package/Libraries/Lists/VirtualizedList.js +1 -0
  44. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -2
  45. package/Libraries/Pressability/Pressability.win32.js +2 -2
  46. package/Libraries/PushNotificationIOS/PushNotificationIOS.d.ts +20 -0
  47. package/Libraries/ReactNative/AppRegistry.d.ts +51 -0
  48. package/Libraries/ReactNative/AppRegistry.js +3 -1
  49. package/Libraries/ReactNative/RootTag.d.ts +13 -0
  50. package/Libraries/StyleSheet/StyleSheet.d.ts +7 -3
  51. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +0 -1
  52. package/Libraries/Utilities/AcessibilityMapping.win32.js +156 -0
  53. package/Libraries/Utilities/createPerformanceLogger.d.ts +48 -0
  54. package/Libraries/Vibration/Vibration.d.ts +1 -1
  55. package/Libraries/__tests__/ButtonWin32-test.js +1 -1
  56. package/Libraries/platform-types.d.ts +7 -13
  57. package/index.win32.js +1 -1
  58. package/jest.config.js +2 -4
  59. package/overrides.json +39 -9
  60. package/package.json +17 -17
  61. package/src/Libraries/Components/Button/ButtonWin32.tsx +8 -8
  62. package/src/Libraries/Components/Text/TextWin32.Props.ts +2 -15
  63. package/src/Libraries/Components/Text/TextWin32.tsx +6 -2
  64. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +5 -5
  65. package/src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +119 -0
  66. package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +1 -1
  67. package/src/Libraries/Components/Touchable/TouchableWin32.tsx +6 -7
  68. package/src/Libraries/Components/View/Tests/ViewWin32Test.tsx +28 -52
  69. package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +527 -0
  70. package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +372 -0
  71. package/src/Libraries/Components/View/ViewWin32.d.ts +30 -0
  72. package/src/Libraries/platform-types.d.ts +7 -13
  73. package/types/index.d.ts +1 -0
  74. package/types/modules/BatchedBridge.d.ts +32 -0
  75. package/types/modules/Codegen.d.ts +74 -0
  76. package/types/modules/Devtools.d.ts +31 -0
  77. package/types/modules/LaunchScreen.d.ts +18 -0
  78. package/types/modules/globals.d.ts +577 -0
  79. package/types/private/TimerMixin.d.ts +19 -0
  80. package/types/private/Utilities.d.ts +10 -0
  81. package/types/public/DeprecatedPropertiesAlias.d.ts +205 -0
  82. package/types/public/Insets.d.ts +15 -0
  83. package/types/public/ReactNativeRenderer.d.ts +149 -0
  84. package/types/public/ReactNativeTypes.d.ts +143 -0
  85. package/Libraries/Components/TextInput/TextInput.win32.d.ts +0 -68
  86. package/Libraries/Components/TextInput/TextInput.win32.js.map +0 -1
  87. package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.d.ts +0 -7
  88. package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.js +0 -3
  89. package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.js.map +0 -1
  90. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js.map +0 -1
  91. package/Libraries/Components/View/ViewWin32.Props.d.ts +0 -174
  92. package/Libraries/Components/View/ViewWin32.Props.js +0 -11
  93. package/Libraries/Components/View/ViewWin32.Props.js.map +0 -1
  94. package/Libraries/Components/View/ViewWin32.js.map +0 -1
  95. package/src/Libraries/Components/TextInput/TextInput.win32.tsx +0 -217
  96. package/src/Libraries/Components/Touchable/TouchableNativeFeedback.Props.ts +0 -9
  97. package/src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.tsx +0 -27
  98. package/src/Libraries/Components/View/ViewWin32.Props.ts +0 -281
  99. package/src/Libraries/Components/View/ViewWin32.tsx +0 -119
package/index.win32.js CHANGED
@@ -466,7 +466,7 @@ module.exports = {
466
466
  .ColorGradientWin32;
467
467
  },
468
468
  get ViewWin32(): any {
469
- return require('./Libraries/Components/View/ViewWin32').ViewWin32;
469
+ return require('./Libraries/Components/View/ViewWin32');
470
470
  },
471
471
  get TextWin32(): any {
472
472
  return require('./Libraries/Components/Text/TextWin32').TextWin32;
package/jest.config.js CHANGED
@@ -1,5 +1,4 @@
1
- module.exports = {
2
- preset: '@rnx-kit/jest-preset',
1
+ module.exports = require('@rnx-kit/jest-preset')("win32", {
3
2
  verbose: true,
4
3
  snapshotResolver: './jest-snapshot-resolver.js',
5
4
  transform: {
@@ -7,7 +6,6 @@ module.exports = {
7
6
  '<rootDir>/jest/assetFileTransformer.js',
8
7
  },
9
8
  transformIgnorePatterns: ['jest-runner'],
10
- setupFiles: ['./jest/setup.js'],
11
9
  fakeTimers: {
12
10
  enableGlobally: true,
13
11
  legacyFakeTimers: true,
@@ -36,4 +34,4 @@ module.exports = {
36
34
  '/vendor/',
37
35
  '<rootDir>/Libraries/react-native/',
38
36
  ],
39
- };
37
+ });
package/overrides.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "**/__snapshots__/**",
8
8
  "src/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.71.0-rc.3",
10
+ "baseVersion": "0.71.0",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
@@ -119,7 +119,7 @@
119
119
  },
120
120
  {
121
121
  "type": "derived",
122
- "file": "src/Libraries/Components/TextInput/TextInput.win32.tsx",
122
+ "file": "src/Libraries/Components/TextInput/TextInput.win32.js",
123
123
  "baseFile": "Libraries/Components/TextInput/TextInput.js",
124
124
  "baseHash": "5de06cf785aabebe8a0bb7331389a5320d7f38c0"
125
125
  },
@@ -148,12 +148,16 @@
148
148
  "issue": 0
149
149
  },
150
150
  {
151
- "type": "platform",
152
- "file": "src/Libraries/Components/Touchable/TouchableNativeFeedback.Props.ts"
151
+ "type": "derived",
152
+ "file": "src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts",
153
+ "baseFile": "Libraries/Components/Touchable/TouchableNativeFeedback.d.ts",
154
+ "baseHash": "b38a2d4fb0c6a08c3ada7748fffded9949c97c2a"
153
155
  },
154
156
  {
155
- "type": "platform",
156
- "file": "src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.tsx"
157
+ "type": "derived",
158
+ "file": "src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js",
159
+ "baseFile": "Libraries/Components/Touchable/TouchableNativeFeedback.js",
160
+ "baseHash": "1fa12a85dc06cdb1093dbe2b54cf3569312b7cc4"
157
161
  },
158
162
  {
159
163
  "type": "platform",
@@ -183,6 +187,24 @@
183
187
  "baseFile": "Libraries/Components/View/View.js",
184
188
  "baseHash": "91864d8f5518fa50da710f545ecdf5727248c45a"
185
189
  },
190
+ {
191
+ "type": "derived",
192
+ "file": "src/Libraries/Components/View/ViewAccessibility.win32.d.ts",
193
+ "baseFile": "Libraries/Components/View/ViewAccessibility.d.ts",
194
+ "baseHash": "fb6095450277c96f033749633af10b42a184e07c"
195
+ },
196
+ {
197
+ "type": "derived",
198
+ "file": "src/Libraries/Components/View/ViewAccessibility.win32.js",
199
+ "baseFile": "Libraries/Components/View/ViewAccessibility.js",
200
+ "baseHash": "b8dca610ae67781f86534eab2373f2a3eb29fca3"
201
+ },
202
+ {
203
+ "type": "derived",
204
+ "file": "src/Libraries/Components/View/ViewPropTypes.win32.d.ts",
205
+ "baseFile": "Libraries/Components/View/ViewPropTypes.d.ts",
206
+ "baseHash": "567b5fd7cc602357daa075d728220ffca0f6c2ac"
207
+ },
186
208
  {
187
209
  "type": "patch",
188
210
  "file": "src/Libraries/Components/View/ViewPropTypes.win32.js",
@@ -191,12 +213,14 @@
191
213
  "issue": 6240
192
214
  },
193
215
  {
194
- "type": "platform",
195
- "file": "src/Libraries/Components/View/ViewWin32.Props.ts"
216
+ "type": "derived",
217
+ "file": "src/Libraries/Components/View/ViewWin32.d.ts",
218
+ "baseFile": "Libraries/Components/View/View.d.ts",
219
+ "baseHash": "c71957187cbae0b40995198a2d7a18d5cae6d662"
196
220
  },
197
221
  {
198
222
  "type": "platform",
199
- "file": "src/Libraries/Components/View/ViewWin32.tsx"
223
+ "file": "src/Libraries/Components/View/ViewWin32.js"
200
224
  },
201
225
  {
202
226
  "type": "patch",
@@ -395,6 +419,12 @@
395
419
  "baseHash": "7fe2b87cf49f4674d731d07f0883bab2f5cfc356",
396
420
  "issue": 6240
397
421
  },
422
+ {
423
+ "type": "derived",
424
+ "file": "src/Libraries/Utilities/AcessibilityMapping.win32.js",
425
+ "baseFile": "Libraries/Utilities/AcessibilityMapping.js",
426
+ "baseHash": "7a662ddd93c6cd0a7193e3002120aeb196991340"
427
+ },
398
428
  {
399
429
  "type": "copy",
400
430
  "file": "src/Libraries/Utilities/BackHandler.win32.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.71.0-preview.2",
3
+ "version": "0.71.1",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "license": "MIT",
6
6
  "main": "./index.win32.js",
@@ -12,9 +12,9 @@
12
12
  "flow-check": "flow check",
13
13
  "lint:fix": "rnw-scripts lint:fix",
14
14
  "lint": "rnw-scripts lint",
15
- "run-win32-dev-web": "npx @office-iss/rex-win32@0.66.15-devmain.15226.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDevMain --useWebDebugger",
16
- "run-win32-devmain": "npx @office-iss/rex-win32@0.66.15-devmain.15226.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDevMain",
17
- "run-win32": "npx @office-iss/rex-win32@0.66.15-devmain.15226.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useWebDebugger",
15
+ "run-win32-dev-web": "npx @office-iss/rex-win32@0.68.26-devmain.16206.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDevMain --useWebDebugger",
16
+ "run-win32-devmain": "npx @office-iss/rex-win32@0.68.26-devmain.16206.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDevMain",
17
+ "run-win32": "npx @office-iss/rex-win32@0.68.26-devmain.16206.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useWebDebugger",
18
18
  "start": "react-native start --projectRoot ../react-native-win32-tester",
19
19
  "test": "jest",
20
20
  "validate-overrides": "react-native-platform-override validate"
@@ -22,9 +22,9 @@
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.0.0",
24
24
  "@jest/create-cache-key-function": "^29.2.1",
25
- "@react-native-community/cli": "10.0.0-alpha.5",
26
- "@react-native-community/cli-platform-android": "10.0.0-alpha.4",
27
- "@react-native-community/cli-platform-ios": "10.0.0-alpha.3",
25
+ "@react-native-community/cli": "10.0.0",
26
+ "@react-native-community/cli-platform-android": "10.0.0",
27
+ "@react-native-community/cli-platform-ios": "10.0.0",
28
28
  "@react-native/assets": "1.0.0",
29
29
  "@react-native/normalize-color": "2.1.0",
30
30
  "@react-native/polyfills": "2.0.0",
@@ -32,15 +32,15 @@
32
32
  "anser": "^1.4.9",
33
33
  "art": "^0.10.0",
34
34
  "base64-js": "^1.1.2",
35
- "deprecated-react-native-prop-types": "^2.3.0",
35
+ "deprecated-react-native-prop-types": "^3.0.1",
36
36
  "event-target-shim": "^5.0.1",
37
37
  "invariant": "^2.2.4",
38
38
  "jest-environment-node": "^29.2.1",
39
39
  "jsc-android": "^250230.2.1",
40
40
  "memoize-one": "^5.0.0",
41
- "metro-react-native-babel-transformer": "0.73.3",
42
- "metro-runtime": "0.73.3",
43
- "metro-source-map": "0.73.3",
41
+ "metro-react-native-babel-transformer": "0.73.5",
42
+ "metro-runtime": "0.73.5",
43
+ "metro-source-map": "0.73.5",
44
44
  "mkdirp": "^0.5.1",
45
45
  "nullthrows": "^1.1.1",
46
46
  "pretty-format": "^26.5.2",
@@ -48,7 +48,7 @@
48
48
  "react-clone-referenced-element": "^1.0.1",
49
49
  "react-devtools-core": "^4.26.1",
50
50
  "react-native-codegen": "^0.71.3",
51
- "react-native-gradle-plugin": "^0.71.10",
51
+ "react-native-gradle-plugin": "^0.71.12",
52
52
  "react-refresh": "^0.4.0",
53
53
  "react-shallow-renderer": "^16.15.0",
54
54
  "regenerator-runtime": "^0.13.2",
@@ -76,20 +76,20 @@
76
76
  "just-scripts": "^1.3.3",
77
77
  "prettier": "^2.4.1",
78
78
  "react": "18.2.0",
79
- "react-native": "0.71.0-rc.3",
79
+ "react-native": "0.71.0",
80
80
  "react-native-platform-override": "^1.8.3",
81
- "typescript": "^4.4.4"
81
+ "typescript": "^4.9.5"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "18.2.0",
85
- "react-native": "0.71.0-rc.3"
85
+ "react-native": "0.71.0"
86
86
  },
87
87
  "beachball": {
88
- "defaultNpmTag": "preview",
88
+ "defaultNpmTag": "latest",
89
89
  "disallowedChangeTypes": [
90
90
  "major",
91
91
  "minor",
92
- "patch"
92
+ "prerelease"
93
93
  ]
94
94
  },
95
95
  "promoteRelease": true,
@@ -1,10 +1,8 @@
1
1
  import React from 'react'
2
2
  import RN = require('react-native');
3
- import { ViewWin32 } from '../View/ViewWin32';
4
- import { IViewWin32Props } from '../View/ViewWin32.Props';
5
- import { TextWin32 } from '../Text/TextWin32';
6
- import { ITextWin32Props } from '../Text/TextWin32.Props';
7
- import { IButtonWin32Props } from './ButtonWin32.Props';
3
+ import type { IViewWin32Props } from '../View/ViewPropTypes.win32';
4
+ import type { ITextWin32Props } from '../Text/TextWin32.Props';
5
+ import type { IButtonWin32Props } from './ButtonWin32.Props';
8
6
 
9
7
  const enum SelectState {
10
8
  NotSelected,
@@ -35,6 +33,7 @@ export class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32
35
33
  onBlur: this._onBlur,
36
34
  onMouseEnter: this.props.onMouseEnter,
37
35
  onMouseLeave: this.props.onMouseLeave,
36
+ // @ts-ignore
38
37
  onTouchStart: this.props.onTouchStart,
39
38
  onTouchEnd: this._onTouchEnd,
40
39
  testID: this.props.testID,
@@ -49,9 +48,10 @@ export class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32
49
48
  }
50
49
 
51
50
  return (
52
- <ViewWin32 {...viewProps}>
53
- <TextWin32 {...textProps}>{this.props.title}</TextWin32>
54
- </ViewWin32>
51
+ // @ts-ignore
52
+ <RN.ViewWin32 {...viewProps}>
53
+ <RN.TextWin32 {...textProps}>{this.props.title}</RN.TextWin32>
54
+ </RN.ViewWin32>
55
55
  );
56
56
  }
57
57
 
@@ -1,18 +1,5 @@
1
1
  import RN = require('react-native');
2
- import { SharedAccessibilityPropsIOSandWin32, OmittedAccessibilityPropsWin32, BasePropsWin32, IKeyboardEvent, IHandledKeyboardEvent } from '../View/ViewWin32.Props';
3
-
4
- // removes from interface T the members of interface K
5
- type Omit<T, K> = Pick<T, Exclude<keyof T, keyof K>>;
6
-
7
- export type TextWin32OmitTypes = Omit<RN.TextPropsAndroid, SharedTextPropsAndroidandWin32> &
8
- RN.TextPropsIOS &
9
- RN.AccessibilityPropsAndroid &
10
- Omit<RN.AccessibilityPropsIOS, SharedAccessibilityPropsIOSandWin32> &
11
- OmittedAccessibilityPropsWin32;
12
-
13
- export type SharedTextPropsAndroidandWin32 = {
14
- selectable?: boolean;
15
- };
2
+ import type { IKeyboardEvent, IHandledKeyboardEvent } from '../View/ViewPropTypes.win32';
16
3
 
17
4
  /**
18
5
  * Role-based text style names.
@@ -31,7 +18,7 @@ export type TextWin32TextStyle =
31
18
  | 'ExtraLargeStandard'
32
19
  | 'HugeStandard';
33
20
 
34
- export interface ITextWin32Props extends Omit<RN.TextProps, TextWin32OmitTypes>, BasePropsWin32 {
21
+ export interface ITextWin32Props extends RN.TextProps {
35
22
  onKeyDown?: (args: IKeyboardEvent) => void;
36
23
  onKeyDownCapture?: (args: IKeyboardEvent) => void;
37
24
  onKeyUp?: (args: IKeyboardEvent) => void;
@@ -1,7 +1,11 @@
1
1
  import React from 'react'
2
2
  import RN = require('react-native');
3
- import { ITextWin32Props } from './TextWin32.Props';
4
- import { UseFrom } from '../View/ViewWin32.Props';
3
+ import type { ITextWin32Props } from './TextWin32.Props';
4
+
5
+ /**
6
+ * All of TOrigin except Key from TUse
7
+ */
8
+ type UseFrom<TOrigin, TUse, Key extends keyof TUse> = Pick<TOrigin, Exclude<keyof TOrigin, Key>> & Pick<TUse, Key>;
5
9
 
6
10
  /**
7
11
  * React-native <Text> control with additional Win32-specific functionality.
@@ -5,7 +5,7 @@ import {NativeSyntheticEvent, StyleSheet, Text, ViewStyle } from 'react-native';
5
5
  import {Insets} from 'react-native/types/public/Insets';
6
6
  import { TextWin32 } from '../../Text/TextWin32';
7
7
  import { ViewWin32 } from '../../View/ViewWin32';
8
- import { IViewWin32Props, IKeyboardEvent } from '../../View/ViewWin32.Props';
8
+ import { IViewWin32Props, IKeyboardEvent } from '../../View/ViewPropTypes.win32';
9
9
  import { TouchableWin32 } from '../TouchableWin32';
10
10
  import { IPressEvent, IRenderChild } from '../TouchableWin32.Types';
11
11
  import { ITouchableWin32State } from '../TouchableWin32.Props';
@@ -263,12 +263,12 @@ class TouchableWin32HighlightComponent extends React.Component<ITouchableWin32Hi
263
263
  private readonly _touchableHandleKeyPressDown = (ev: IKeyboardEvent) => {
264
264
  this.props.onKeyPressDown && this.props.onKeyPressDown(ev);
265
265
  }
266
- private readonly _mouseEnter = (): void => {
267
- this.props.onMouseEnter && this.props.onMouseEnter();
266
+ private readonly _mouseEnter = (mouseEvent): void => {
267
+ this.props.onMouseEnter && this.props.onMouseEnter(mouseEvent);
268
268
  this.setState({ isMouseIn: true });
269
269
  };
270
- private readonly _mouseLeave = (): void => {
271
- this.props.onMouseLeave && this.props.onMouseLeave();
270
+ private readonly _mouseLeave = (mouseEvent): void => {
271
+ this.props.onMouseLeave && this.props.onMouseLeave(mouseEvent);
272
272
  this.setState({ isMouseIn: false });
273
273
  };
274
274
  private readonly _onFocus = (ev: NativeSyntheticEvent<{}>): void => {
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+ import type * as React from 'react';
11
+ import {Constructor} from '../../../types/private/Utilities';
12
+ import {ColorValue} from '../../StyleSheet/StyleSheet';
13
+ import {TouchableMixin} from './Touchable';
14
+
15
+ import type {TVProps} from './TouchableOpacity';
16
+ import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
17
+
18
+ interface BaseBackgroundPropType {
19
+ type: string;
20
+ rippleRadius?: number | null | undefined;
21
+ }
22
+
23
+ interface RippleBackgroundPropType extends BaseBackgroundPropType {
24
+ type: 'RippleAndroid';
25
+ borderless: boolean;
26
+ color?: number | null | undefined;
27
+ }
28
+
29
+ interface ThemeAttributeBackgroundPropType extends BaseBackgroundPropType {
30
+ type: 'ThemeAttrAndroid';
31
+ attribute: string;
32
+ }
33
+
34
+ type BackgroundPropType =
35
+ | RippleBackgroundPropType
36
+ | ThemeAttributeBackgroundPropType;
37
+
38
+ /**
39
+ * @see https://reactnative.dev/docs/touchablenativefeedback#props
40
+ */
41
+ export interface TouchableNativeFeedbackProps
42
+ extends TouchableWithoutFeedbackProps,
43
+ TVProps {
44
+ /**
45
+ * Determines the type of background drawable that's going to be used to display feedback.
46
+ * It takes an object with type property and extra data depending on the type.
47
+ * It's recommended to use one of the following static methods to generate that dictionary:
48
+ * 1) TouchableNativeFeedback.SelectableBackground() - will create object that represents android theme's
49
+ * default background for selectable elements (?android:attr/selectableItemBackground)
50
+ * 2) TouchableNativeFeedback.SelectableBackgroundBorderless() - will create object that represent android
51
+ * theme's default background for borderless selectable elements
52
+ * (?android:attr/selectableItemBackgroundBorderless). Available on android API level 21+
53
+ * 3) TouchableNativeFeedback.Ripple(color, borderless) - will create object that represents ripple drawable
54
+ * with specified color (as a string). If property borderless evaluates to true the ripple will render
55
+ * outside of the view bounds (see native actionbar buttons as an example of that behavior). This background
56
+ * type is available on Android API level 21+
57
+ */
58
+ background?: BackgroundPropType | undefined;
59
+ useForeground?: boolean | undefined;
60
+
61
+ tooltip?: string; // Win32
62
+ }
63
+
64
+ /**
65
+ * A wrapper for making views respond properly to touches (Android only).
66
+ * On Android this component uses native state drawable to display touch feedback.
67
+ * At the moment it only supports having a single View instance as a child node,
68
+ * as it's implemented by replacing that View with another instance of RCTView node with some additional properties set.
69
+ *
70
+ * Background drawable of native feedback touchable can be customized with background property.
71
+ *
72
+ * @see https://reactnative.dev/docs/touchablenativefeedback#content
73
+ */
74
+ declare class TouchableNativeFeedbackComponent extends React.Component<TouchableNativeFeedbackProps> {}
75
+ declare const TouchableNativeFeedbackBase: Constructor<TouchableMixin> &
76
+ typeof TouchableNativeFeedbackComponent;
77
+ export class TouchableNativeFeedback extends TouchableNativeFeedbackBase {
78
+ /**
79
+ * Creates an object that represents android theme's default background for
80
+ * selectable elements (?android:attr/selectableItemBackground).
81
+ *
82
+ * @param rippleRadius The radius of ripple effect
83
+ */
84
+ static SelectableBackground(
85
+ rippleRadius?: number | null,
86
+ ): ThemeAttributeBackgroundPropType;
87
+
88
+ /**
89
+ * Creates an object that represent android theme's default background for borderless
90
+ * selectable elements (?android:attr/selectableItemBackgroundBorderless).
91
+ * Available on android API level 21+.
92
+ *
93
+ * @param rippleRadius The radius of ripple effect
94
+ */
95
+ static SelectableBackgroundBorderless(
96
+ rippleRadius?: number | null,
97
+ ): ThemeAttributeBackgroundPropType;
98
+
99
+ /**
100
+ * Creates an object that represents ripple drawable with specified color (as a
101
+ * string). If property `borderless` evaluates to true the ripple will
102
+ * render outside of the view bounds (see native actionbar buttons as an
103
+ * example of that behavior). This background type is available on Android
104
+ * API level 21+.
105
+ *
106
+ * @param color The ripple color
107
+ * @param borderless If the ripple can render outside it's bounds
108
+ * @param rippleRadius The radius of ripple effect
109
+ */
110
+ static Ripple(
111
+ color: ColorValue,
112
+ borderless: boolean,
113
+ rippleRadius?: number | null,
114
+ ): RippleBackgroundPropType;
115
+ static canUseNativeForeground(): boolean;
116
+ }
117
+
118
+ // For backcompat
119
+ export type ITouchableNativeFeedbackProps = TouchableNativeFeedbackProps;
@@ -2,7 +2,7 @@ import {ViewStyle} from 'react-native';
2
2
  import {Insets} from 'react-native/types/public/Insets';
3
3
 
4
4
  import { IPressEvent, IRenderChild, IRenderStyle } from './TouchableWin32.Types';
5
- import { IViewWin32Props, IKeyboardEvent } from '../View/ViewWin32.Props';
5
+ import { IViewWin32Props, IKeyboardEvent } from '../View/ViewPropTypes.win32';
6
6
 
7
7
  export interface ITouchableWin32State {
8
8
  isPressed: boolean;
@@ -11,7 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  import React from 'react'
14
- import { NativeSyntheticEvent, StyleProp, UIManager, ViewStyle } from 'react-native';
14
+ import { NativeSyntheticEvent, StyleProp, UIManager, ViewStyle, ViewWin32 } from 'react-native';
15
15
 
16
16
  import { ITouchableWin32Props, ITouchableWin32State } from './TouchableWin32.Props';
17
17
  import {
@@ -25,8 +25,7 @@ import {
25
25
  IStateConditions,
26
26
  ITransitions,
27
27
  } from './TouchableWin32.Types';
28
- import { ViewWin32 } from '../View/ViewWin32';
29
- import { IKeyboardEvent } from '../View/ViewWin32.Props';
28
+ import { IKeyboardEvent } from '../View/ViewPropTypes.win32';
30
29
 
31
30
  const BoundingDimensions = require('./BoundingDimensions');
32
31
  const Position = require('./Position');
@@ -568,14 +567,14 @@ export class TouchableWin32 extends React.Component<ITouchableWin32Props, IInter
568
567
  }
569
568
  };
570
569
 
571
- private readonly _onMouseEnter = () => {
570
+ private readonly _onMouseEnter = (mouseEvent) => {
572
571
  this.setState({ isHovered: true });
573
- this.props.onMouseEnter && this.props.onMouseEnter();
572
+ this.props.onMouseEnter && this.props.onMouseEnter(mouseEvent);
574
573
  };
575
574
 
576
- private readonly _onMouseLeave = () => {
575
+ private readonly _onMouseLeave = (mouseEvent) => {
577
576
  this.setState({ isHovered: false });
578
- this.props.onMouseLeave && this.props.onMouseLeave();
577
+ this.props.onMouseLeave && this.props.onMouseLeave(mouseEvent);
579
578
  };
580
579
 
581
580
  private readonly _onFocus = (ev: NativeSyntheticEvent<{}>) => {
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
  import React from 'react'
3
3
  import { StyleSheet, Text, TouchableHighlight } from 'react-native';
4
- import { ViewWin32 } from '../ViewWin32';
5
- import { Cursor, IKeyboardEvent, IHandledKeyboardEvent } from '../ViewWin32.Props';
4
+ import { Cursor, IKeyboardEvent, IHandledKeyboardEvent, ViewWin32 } from '@office-iss/react-native-win32';
6
5
 
7
6
  const styles = StyleSheet.create({
8
7
  border: {
@@ -29,61 +28,38 @@ interface IFocusableComponentState {
29
28
  hasFocus: boolean;
30
29
  }
31
30
 
32
- class FocusMoverTestComponent extends React.Component<{}, IFocusableComponentState> {
33
- private _focusTarget: ViewWin32 = null;
34
- private readonly _labeledBy: React.RefObject<ViewWin32>;
31
+ function FocusMoverTestComponent() {
32
+ const [hasFocus, setHasFocus] = React.useState<boolean>(false);
35
33
 
36
- public constructor(props) {
37
- super(props);
38
- this.state = {
39
- hasFocus: false,
40
- };
41
- this._labeledBy = React.createRef<ViewWin32>();
42
- }
43
- public render() {
44
- return (
45
- <ViewWin32>
46
- <ViewWin32 ref={this._labeledBy} accessibilityLabel="separate label for test" accessibilityItemType="Comment" />
47
- <ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>
48
- <TouchableHighlight onPress={this._onPress}>
49
- <ViewWin32 accessibilityLabeledBy={this._labeledBy} style={styles.blackbox} />
50
- </TouchableHighlight>
51
- <ViewWin32
52
- ref={this._setRef}
53
- focusable
54
- style={this.state.hasFocus ? { backgroundColor: '#aee8fcff' } : { backgroundColor: '#00000000' }}
55
- onFocus={this._onFocus}
56
- onBlur={this._onBlur}
57
- enableFocusRing={false}
58
- >
59
- <Text>{this.state.hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>
60
- </ViewWin32>
61
- </ViewWin32>
62
- </ViewWin32>
63
- );
64
- }
34
+ const labelId = React.useId();
65
35
 
66
- private readonly _setRef = (ref: ViewWin32) => {
67
- this._focusTarget = ref;
68
- };
69
-
70
- private readonly _onPress = () => {
71
- if (this._focusTarget !== undefined) {
72
- this._focusTarget.focus();
36
+ const ref = React.useRef<ViewWin32>(null);
37
+ const onBtnPress = () => {
38
+ if (ref.current) {
39
+ ref.current.focus();
73
40
  }
74
41
  };
75
42
 
76
- private readonly _onFocus = () => {
77
- this.setState({
78
- hasFocus: true,
79
- });
80
- };
81
-
82
- private readonly _onBlur = () => {
83
- this.setState({
84
- hasFocus: false,
85
- });
86
- };
43
+ return (
44
+ <ViewWin32>
45
+ <ViewWin32 nativeID={labelId} accessibilityLabel="separate label for test" accessibilityItemType="Comment" />
46
+ <ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>
47
+ <TouchableHighlight onPress={onBtnPress}>
48
+ <ViewWin32 accessibilityLabelledBy={labelId} style={styles.blackbox} />
49
+ </TouchableHighlight>
50
+ <ViewWin32
51
+ ref={ref}
52
+ focusable
53
+ style={hasFocus ? { backgroundColor: '#aee8fcff' } : { backgroundColor: '#00000000' }}
54
+ onFocus={() => setHasFocus(true)}
55
+ onBlur={() => setHasFocus(false)}
56
+ enableFocusRing={false}
57
+ >
58
+ <Text>{hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>
59
+ </ViewWin32>
60
+ </ViewWin32>
61
+ </ViewWin32>
62
+ );
87
63
  }
88
64
 
89
65
  interface IKeyboardableComponentState {