@office-iss/react-native-win32 0.83.0-preview.1 → 0.84.0-preview.2

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 (193) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +57 -6
  3. package/CHANGELOG.md +30 -5
  4. package/IntegrationTests/AccessibilityManagerTest.js +10 -7
  5. package/IntegrationTests/ImageCachePolicyTest.js +8 -8
  6. package/IntegrationTests/IntegrationTestsApp.js +3 -3
  7. package/IntegrationTests/LayoutEventsTest.js +1 -1
  8. package/IntegrationTests/TimersTest.js +1 -1
  9. package/IntegrationTests/WebSocketTest.js +1 -1
  10. package/Libraries/Animated/AnimatedEvent.js +2 -2
  11. package/Libraries/Animated/animations/Animation.js +1 -3
  12. package/Libraries/Animated/createAnimatedComponent.js +8 -5
  13. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  14. package/Libraries/Animated/nodes/AnimatedInterpolation.js +40 -4
  15. package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
  16. package/Libraries/Animated/nodes/AnimatedObject.js +16 -11
  17. package/Libraries/Animated/nodes/AnimatedProps.js +43 -12
  18. package/Libraries/Animated/nodes/AnimatedStyle.js +12 -12
  19. package/Libraries/Animated/nodes/AnimatedValue.js +6 -3
  20. package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
  21. package/Libraries/BatchedBridge/MessageQueue.js +24 -22
  22. package/Libraries/Blob/URL.js +34 -3
  23. package/Libraries/Blob/URLSearchParams.js +1 -0
  24. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
  25. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
  26. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +8 -1
  27. package/Libraries/Components/Button.js +2 -5
  28. package/Libraries/Components/Button.win32.js +2 -5
  29. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  30. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
  31. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  32. package/Libraries/Components/Pressable/Pressable.js +8 -8
  33. package/Libraries/Components/Pressable/Pressable.win32.js +14 -13
  34. package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
  35. package/Libraries/Components/TextInput/TextInput.flow.win32.js +13 -13
  36. package/Libraries/Components/TextInput/TextInput.js +33 -34
  37. package/Libraries/Components/TextInput/TextInput.win32.js +39 -39
  38. package/Libraries/Components/Touchable/PooledClass.js +2 -2
  39. package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
  40. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  41. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +1 -1
  42. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
  43. package/Libraries/Components/View/View.win32.js +5 -5
  44. package/Libraries/Components/View/ViewPropTypes.js +16 -6
  45. package/Libraries/Components/View/ViewPropTypes.win32.js +20 -10
  46. package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
  47. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +6 -3
  48. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  49. package/Libraries/Core/ExceptionsManager.js +3 -3
  50. package/Libraries/Core/RawEventEmitter.js +1 -1
  51. package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
  52. package/Libraries/Core/ReactNativeVersion.js +3 -3
  53. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  54. package/Libraries/Core/setUpErrorHandling.js +1 -1
  55. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
  56. package/Libraries/Image/Image.android.js +2 -2
  57. package/Libraries/Image/Image.ios.js +2 -2
  58. package/Libraries/Image/Image.win32.js +1 -1
  59. package/Libraries/Image/ImageProps.js +1 -1
  60. package/Libraries/Image/ImageTypes.flow.js +2 -2
  61. package/Libraries/Interaction/InteractionManager.js +3 -3
  62. package/Libraries/Interaction/PanResponder.js +1 -1
  63. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  64. package/Libraries/Linking/Linking.js +1 -1
  65. package/Libraries/Lists/FlatList.js +2 -2
  66. package/Libraries/LogBox/Data/LogBoxData.js +31 -4
  67. package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
  68. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  69. package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
  70. package/Libraries/LogBox/LogBox.js +7 -7
  71. package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
  72. package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
  73. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
  74. package/Libraries/Network/RCTNetworking.android.js +3 -3
  75. package/Libraries/Network/RCTNetworking.ios.js +2 -2
  76. package/Libraries/Network/RCTNetworking.js.flow +2 -2
  77. package/Libraries/Network/RCTNetworking.win32.js +2 -2
  78. package/Libraries/Pressability/Pressability.js +9 -9
  79. package/Libraries/Pressability/Pressability.win32.js +17 -16
  80. package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
  81. package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
  82. package/Libraries/ReactNative/FabricUIManager.js +1 -1
  83. package/Libraries/ReactNative/PaperUIManager.js +1 -1
  84. package/Libraries/ReactNative/PaperUIManager.win32.js +1 -1
  85. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
  86. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
  87. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
  88. package/Libraries/ReactNative/RendererImplementation.js +1 -1
  89. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  90. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
  91. package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
  92. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  93. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  94. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +11 -4
  95. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -4
  96. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -4
  97. package/Libraries/Renderer/shims/ReactFabric.js +3 -1
  98. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  99. package/Libraries/Renderer/shims/ReactNative.js +2 -2
  100. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
  101. package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +3 -1
  102. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  103. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  104. package/Libraries/Settings/Settings.ios.js +1 -1
  105. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  106. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  107. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
  108. package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
  109. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
  110. package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
  111. package/Libraries/StyleSheet/processFilter.js +1 -1
  112. package/Libraries/Text/Text.js +46 -6
  113. package/Libraries/Text/Text.win32.js +46 -6
  114. package/Libraries/Text/TextNativeComponent.js +1 -1
  115. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  116. package/Libraries/Text/TextProps.js +7 -7
  117. package/Libraries/Text/TextProps.win32.js +7 -7
  118. package/Libraries/Types/CodegenTypes.js +1 -1
  119. package/Libraries/Types/CoreEventTypes.js +31 -0
  120. package/Libraries/Types/CoreEventTypes.win32.js +30 -13
  121. package/Libraries/Types/ReactDevToolsTypes.js +2 -2
  122. package/Libraries/Utilities/Appearance.js +2 -2
  123. package/Libraries/Utilities/DevLoadingView.js +8 -1
  124. package/Libraries/Utilities/DevSettings.js +3 -3
  125. package/Libraries/Utilities/HMRClient.js +4 -3
  126. package/Libraries/Utilities/RCTLog.js +3 -3
  127. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  128. package/Libraries/Utilities/SceneTracker.js +1 -1
  129. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  130. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
  131. package/Libraries/Utilities/logError.js +1 -1
  132. package/Libraries/Utilities/stringifySafe.js +7 -7
  133. package/Libraries/Utilities/useRefEffect.js +1 -1
  134. package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
  135. package/Libraries/promiseRejectionTrackingOptions.js +8 -8
  136. package/Libraries/vendor/core/ErrorUtils.js +10 -10
  137. package/Libraries/vendor/emitter/EventEmitter.js +6 -6
  138. package/flow/HermesInternalType.js +6 -6
  139. package/flow/bom.js.flow +35 -28
  140. package/flow/cssom.js.flow +3 -3
  141. package/flow/dom.js.flow +34 -33
  142. package/index.js +3 -0
  143. package/index.win32.js +3 -0
  144. package/index.win32.js.flow +8 -0
  145. package/jest/mock.js +2 -2
  146. package/jest/mockComponent.js +1 -1
  147. package/jest/setup.js +1 -1
  148. package/overrides.json +23 -23
  149. package/package.json +19 -18
  150. package/src/private/animated/NativeAnimatedHelper.js +130 -125
  151. package/src/private/animated/NativeAnimatedHelper.win32.js +130 -125
  152. package/src/private/animated/NativeAnimatedValidation.js +7 -4
  153. package/src/private/animated/createAnimatedPropsHook.js +13 -5
  154. package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
  155. package/src/private/components/virtualview/VirtualView.js +16 -9
  156. package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
  157. package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
  158. package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
  159. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
  160. package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
  161. package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
  162. package/src/private/featureflags/ReactNativeFeatureFlags.js +63 -42
  163. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
  164. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +12 -9
  165. package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
  166. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
  167. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
  168. package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
  169. package/src/private/webapis/dom/events/CustomEvent.js +3 -3
  170. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
  171. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  172. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
  173. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
  174. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  175. package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
  176. package/src/private/webapis/html/events/MessageEvent.js +3 -3
  177. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
  178. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +53 -5
  179. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
  180. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
  181. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
  182. package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
  183. package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
  184. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
  185. package/src/private/webapis/performance/Performance.js +1 -1
  186. package/src/private/webapis/performance/UserTiming.js +1 -1
  187. package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
  188. package/src/private/webapis/structuredClone/structuredClone.js +3 -3
  189. package/src/types/globals.d.ts +30 -1
  190. package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
  191. package/src-win/index.win32.js.flow +8 -0
  192. package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
  193. package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
@@ -343,8 +343,8 @@ export type DropShadowValue = {
343
343
  export type BoxShadowValue = {
344
344
  offsetX: number | string;
345
345
  offsetY: number | string;
346
- color?: string | undefined;
347
- blurRadius?: ColorValue | number | undefined;
346
+ color?: ColorValue | undefined;
347
+ blurRadius?: string | number | undefined;
348
348
  spreadDistance?: number | string | undefined;
349
349
  inset?: boolean | undefined;
350
350
  };
@@ -367,7 +367,7 @@ export type BlendMode =
367
367
  | 'color'
368
368
  | 'luminosity';
369
369
 
370
- export type GradientValue = {
370
+ export type LinearGradientValue = {
371
371
  type: 'linear-gradient';
372
372
  // Angle or direction enums
373
373
  direction?: string | undefined;
@@ -377,6 +377,89 @@ export type GradientValue = {
377
377
  }>;
378
378
  };
379
379
 
380
+ export type GradientValue = LinearGradientValue;
381
+
382
+ type RadialExtent =
383
+ | 'closest-corner'
384
+ | 'closest-side'
385
+ | 'farthest-corner'
386
+ | 'farthest-side';
387
+ export type RadialGradientPosition =
388
+ | {
389
+ top: number | string;
390
+ left: number | string;
391
+ }
392
+ | {
393
+ top: number | string;
394
+ right: number | string;
395
+ }
396
+ | {
397
+ bottom: number | string;
398
+ left: number | string;
399
+ }
400
+ | {
401
+ bottom: number | string;
402
+ right: number | string;
403
+ };
404
+
405
+ export type RadialGradientShape = 'circle' | 'ellipse';
406
+ export type RadialGradientSize =
407
+ | RadialExtent
408
+ | {
409
+ x: string | number;
410
+ y: string | number;
411
+ };
412
+
413
+ type RadialGradientValue = {
414
+ type: 'radial-gradient';
415
+ shape: RadialGradientShape;
416
+ size: RadialGradientSize;
417
+ position: RadialGradientPosition;
418
+ colorStops: ReadonlyArray<{
419
+ color: ColorValue | null;
420
+ positions?: ReadonlyArray<string> | undefined;
421
+ }>;
422
+ };
423
+
424
+ export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;
425
+
426
+ export type BackgroundSizeValue =
427
+ | {
428
+ x: string | number;
429
+ y: string | number;
430
+ }
431
+ | 'cover'
432
+ | 'contain';
433
+
434
+ export type BackgroundRepeatKeyword =
435
+ | 'repeat'
436
+ | 'space'
437
+ | 'round'
438
+ | 'no-repeat';
439
+
440
+ export type BackgroundPositionValue =
441
+ | {
442
+ top: number | string;
443
+ left: number | string;
444
+ }
445
+ | {
446
+ top: number | string;
447
+ right: number | string;
448
+ }
449
+ | {
450
+ bottom: number | string;
451
+ left: number | string;
452
+ }
453
+ | {
454
+ bottom: number | string;
455
+ right: number | string;
456
+ };
457
+
458
+ export type BackgroundRepeatValue = {
459
+ x: BackgroundRepeatKeyword;
460
+ y: BackgroundRepeatKeyword;
461
+ };
462
+
380
463
  /**
381
464
  * @see https://reactnative.dev/docs/view#style
382
465
  */
@@ -437,7 +520,19 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
437
520
 
438
521
  mixBlendMode?: BlendMode | undefined;
439
522
  experimental_backgroundImage?:
440
- | ReadonlyArray<GradientValue>
523
+ | ReadonlyArray<BackgroundImageValue>
524
+ | string
525
+ | undefined;
526
+ experimental_backgroundSize?:
527
+ | ReadonlyArray<BackgroundSizeValue>
528
+ | string
529
+ | undefined;
530
+ experimental_backgroundPosition?:
531
+ | ReadonlyArray<BackgroundPositionValue>
532
+ | string
533
+ | undefined;
534
+ experimental_backgroundRepeat?:
535
+ | ReadonlyArray<BackgroundRepeatValue>
441
536
  | string
442
537
  | undefined;
443
538
  }
@@ -1104,22 +1104,20 @@ export type ____Styles_Internal = {
1104
1104
  // ____FlattenStyleProp_Helper should be considered internal.
1105
1105
  type FlattenDepthLimiter = [void, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
1106
1106
  type ____FlattenStyleProp_Helper<
1107
- +TStyleProp: StyleProp<mixed>,
1107
+ +TStyleProp: StyleProp<unknown>,
1108
1108
  Depth: $Values<FlattenDepthLimiter> = 9,
1109
1109
  > = Depth extends 0
1110
1110
  ? empty
1111
1111
  : TStyleProp extends null | void | false | ''
1112
- ? empty
1113
- : // When TStyleProp is an array, recurse with decremented Depth
1114
- TStyleProp extends $ReadOnlyArray<infer V>
1112
+ ? empty // When TStyleProp is an array, recurse with decremented Depth
1113
+ : TStyleProp extends $ReadOnlyArray<infer V>
1115
1114
  ? ____FlattenStyleProp_Helper<
1116
1115
  V,
1117
1116
  Depth extends number ? FlattenDepthLimiter[Depth] : 0,
1118
1117
  >
1119
1118
  : TStyleProp;
1120
1119
 
1121
- export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<mixed>> =
1122
- ____FlattenStyleProp_Helper<TStyleProp> extends empty
1123
- ? // $FlowFixMe[unclear-type]
1124
- any
1120
+ export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<unknown>> =
1121
+ ____FlattenStyleProp_Helper<TStyleProp> extends empty // $FlowFixMe[unclear-type]
1122
+ ? any
1125
1123
  : ____FlattenStyleProp_Helper<TStyleProp>;
@@ -115,7 +115,7 @@ export default function processFilter(
115
115
  return result;
116
116
  }
117
117
 
118
- function _getFilterAmount(filterName: string, filterArgs: mixed): ?number {
118
+ function _getFilterAmount(filterName: string, filterArgs: unknown): ?number {
119
119
  let filterArgAsNumber: number;
120
120
  let unit: string;
121
121
  if (typeof filterArgs === 'string') {
@@ -45,6 +45,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
45
45
  ref: forwardedRef,
46
46
  accessible,
47
47
  accessibilityLabel,
48
+ accessibilityRole,
48
49
  accessibilityState,
49
50
  allowFontScaling,
50
51
  'aria-busy': ariaBusy,
@@ -71,6 +72,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
71
72
  onResponderTerminationRequest,
72
73
  onStartShouldSetResponder,
73
74
  pressRetentionOffset,
75
+ role,
74
76
  selectable,
75
77
  selectionColor,
76
78
  suppressHighlighting,
@@ -149,6 +151,17 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
149
151
  onStartShouldSetResponder != null) &&
150
152
  _disabled !== true;
151
153
 
154
+ const shouldUseLinkRole =
155
+ ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
156
+ isPressable &&
157
+ accessibilityRole == null &&
158
+ role == null;
159
+
160
+ const _accessibilityRole =
161
+ accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
162
+
163
+ const _role = shouldUseLinkRole ? undefined : role;
164
+
152
165
  // TODO: Move this processing to the view configuration.
153
166
  const _selectionColor =
154
167
  selectionColor != null ? processColor(selectionColor) : undefined;
@@ -206,6 +219,9 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
206
219
  if (_accessibilityLabel !== undefined) {
207
220
  processedProps.accessibilityLabel = _accessibilityLabel;
208
221
  }
222
+ if (_accessibilityRole !== undefined) {
223
+ processedProps.accessibilityRole = _accessibilityRole;
224
+ }
209
225
  if (_accessibilityState !== undefined) {
210
226
  processedProps.accessibilityState = _accessibilityState;
211
227
  }
@@ -224,6 +240,9 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
224
240
  if (_selectionColor !== undefined) {
225
241
  processedProps.selectionColor = _selectionColor;
226
242
  }
243
+ if (_role !== undefined) {
244
+ processedProps.role = _role;
245
+ }
227
246
 
228
247
  let textPressabilityProps: ?TextPressabilityProps;
229
248
  if (isPressable) {
@@ -317,6 +336,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
317
336
  accessibilityElementsHidden,
318
337
  importantForAccessibility,
319
338
  accessibilityLabel,
339
+ accessibilityRole,
320
340
  accessibilityState,
321
341
  allowFontScaling,
322
342
  'aria-busy': ariaBusy,
@@ -343,6 +363,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
343
363
  onResponderTerminationRequest,
344
364
  onStartShouldSetResponder,
345
365
  pressRetentionOffset,
366
+ role,
346
367
  selectable,
347
368
  selectionColor,
348
369
  suppressHighlighting,
@@ -398,6 +419,17 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
398
419
  onStartShouldSetResponder != null) &&
399
420
  _disabled !== true;
400
421
 
422
+ const shouldUseLinkRole =
423
+ ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
424
+ isPressable &&
425
+ accessibilityRole == null &&
426
+ role == null;
427
+
428
+ const _accessibilityRole =
429
+ accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
430
+
431
+ const _role = shouldUseLinkRole ? undefined : role;
432
+
401
433
  // TODO: Move this processing to the view configuration.
402
434
  const _selectionColor =
403
435
  selectionColor != null ? processColor(selectionColor) : undefined;
@@ -462,6 +494,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
462
494
  ...restProps,
463
495
  accessibilityElementsHidden: _accessibilityElementsHidden,
464
496
  accessibilityLabel: _accessibilityLabel,
497
+ accessibilityRole: _accessibilityRole,
465
498
  accessibilityState: _accessibilityState,
466
499
  importantForAccessibility: _importantForAccessibility,
467
500
  nativeID: _nativeID,
@@ -470,6 +503,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
470
503
  selectionColor: _selectionColor,
471
504
  style: _style,
472
505
  disabled: disabled,
506
+ role: _role,
473
507
  children,
474
508
  }}
475
509
  textPressabilityProps={{
@@ -495,6 +529,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
495
529
  {...restProps}
496
530
  accessibilityElementsHidden={_accessibilityElementsHidden}
497
531
  accessibilityLabel={_accessibilityLabel}
532
+ accessibilityRole={_accessibilityRole}
498
533
  accessibilityState={_accessibilityState}
499
534
  importantForAccessibility={_importantForAccessibility}
500
535
  nativeID={_nativeID}
@@ -503,7 +538,8 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
503
538
  selectable={_selectable}
504
539
  selectionColor={_selectionColor}
505
540
  style={_style}
506
- disabled={disabled}>
541
+ disabled={disabled}
542
+ role={_role}>
507
543
  {children}
508
544
  </NativeVirtualText>
509
545
  );
@@ -538,6 +574,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
538
574
  ...restProps,
539
575
  accessibilityElementsHidden: _accessibilityElementsHidden,
540
576
  accessibilityLabel: _accessibilityLabel,
577
+ accessibilityRole: _accessibilityRole,
541
578
  accessibilityState: _accessibilityState,
542
579
  accessible: _accessible,
543
580
  allowFontScaling: allowFontScaling !== false,
@@ -549,6 +586,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
549
586
  selectable: _selectable,
550
587
  selectionColor: _selectionColor,
551
588
  style: _style,
589
+ role: _role,
552
590
  children,
553
591
  }}
554
592
  textPressabilityProps={{
@@ -573,6 +611,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
573
611
  {...restProps}
574
612
  accessibilityElementsHidden={_accessibilityElementsHidden}
575
613
  accessibilityLabel={_accessibilityLabel}
614
+ accessibilityRole={_accessibilityRole}
576
615
  accessibilityState={_accessibilityState}
577
616
  accessible={_accessible}
578
617
  allowFontScaling={allowFontScaling !== false}
@@ -584,7 +623,8 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
584
623
  ref={forwardedRef}
585
624
  selectable={_selectable}
586
625
  selectionColor={_selectionColor}
587
- style={_style}>
626
+ style={_style}
627
+ role={_role}>
588
628
  {children}
589
629
  </NativeText>
590
630
  );
@@ -628,10 +668,10 @@ const TextImpl: component(
628
668
  TextImpl.displayName = 'Text';
629
669
 
630
670
  type TextPressabilityProps = $ReadOnly<{
631
- onLongPress?: ?(event: GestureResponderEvent) => mixed,
632
- onPress?: ?(event: GestureResponderEvent) => mixed,
633
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
634
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
671
+ onLongPress?: ?(event: GestureResponderEvent) => unknown,
672
+ onPress?: ?(event: GestureResponderEvent) => unknown,
673
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
674
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
635
675
  onResponderGrant?: ?(event: GestureResponderEvent) => void,
636
676
  onResponderMove?: ?(event: GestureResponderEvent) => void,
637
677
  onResponderRelease?: ?(event: GestureResponderEvent) => void,
@@ -45,6 +45,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
45
45
  ref: forwardedRef,
46
46
  accessible,
47
47
  accessibilityLabel,
48
+ accessibilityRole,
48
49
  accessibilityState,
49
50
  allowFontScaling,
50
51
  'aria-busy': ariaBusy,
@@ -87,6 +88,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
87
88
  onResponderTerminationRequest,
88
89
  onStartShouldSetResponder,
89
90
  pressRetentionOffset,
91
+ role,
90
92
  selectable,
91
93
  selectionColor,
92
94
  suppressHighlighting,
@@ -186,6 +188,17 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
186
188
  onStartShouldSetResponder != null) &&
187
189
  _disabled !== true;
188
190
 
191
+ const shouldUseLinkRole =
192
+ ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
193
+ isPressable &&
194
+ accessibilityRole == null &&
195
+ role == null;
196
+
197
+ const _accessibilityRole =
198
+ accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
199
+
200
+ const _role = shouldUseLinkRole ? undefined : role;
201
+
189
202
  // TODO: Move this processing to the view configuration.
190
203
  const _selectionColor =
191
204
  selectionColor != null ? processColor(selectionColor) : undefined;
@@ -243,6 +256,9 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
243
256
  if (_accessibilityLabel !== undefined) {
244
257
  processedProps.accessibilityLabel = _accessibilityLabel;
245
258
  }
259
+ if (_accessibilityRole !== undefined) {
260
+ processedProps.accessibilityRole = _accessibilityRole;
261
+ }
246
262
  if (_accessibilityState !== undefined) {
247
263
  processedProps.accessibilityState = _accessibilityState;
248
264
  }
@@ -261,6 +277,9 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
261
277
  if (_selectionColor !== undefined) {
262
278
  processedProps.selectionColor = _selectionColor;
263
279
  }
280
+ if (_role !== undefined) {
281
+ processedProps.role = _role;
282
+ }
264
283
 
265
284
  // [Windows accessibility properties
266
285
  if (_accessibilityControls !== undefined) {
@@ -378,6 +397,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
378
397
  accessibilityElementsHidden,
379
398
  importantForAccessibility,
380
399
  accessibilityLabel,
400
+ accessibilityRole,
381
401
  accessibilityState,
382
402
  allowFontScaling,
383
403
  'aria-busy': ariaBusy,
@@ -420,6 +440,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
420
440
  onResponderTerminationRequest,
421
441
  onStartShouldSetResponder,
422
442
  pressRetentionOffset,
443
+ role,
423
444
  selectable,
424
445
  selectionColor,
425
446
  suppressHighlighting,
@@ -495,6 +516,17 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
495
516
  onStartShouldSetResponder != null) &&
496
517
  _disabled !== true;
497
518
 
519
+ const shouldUseLinkRole =
520
+ ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
521
+ isPressable &&
522
+ accessibilityRole == null &&
523
+ role == null;
524
+
525
+ const _accessibilityRole =
526
+ accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
527
+
528
+ const _role = shouldUseLinkRole ? undefined : role;
529
+
498
530
  // TODO: Move this processing to the view configuration.
499
531
  const _selectionColor =
500
532
  selectionColor != null ? processColor(selectionColor) : undefined;
@@ -559,6 +591,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
559
591
  ...restProps,
560
592
  accessibilityElementsHidden: _accessibilityElementsHidden,
561
593
  accessibilityLabel: _accessibilityLabel,
594
+ accessibilityRole: _accessibilityRole,
562
595
  accessibilityState: _accessibilityState,
563
596
  importantForAccessibility: _importantForAccessibility,
564
597
  // #[ Win32
@@ -575,6 +608,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
575
608
  selectionColor: _selectionColor,
576
609
  style: _style,
577
610
  disabled: disabled,
611
+ role: _role,
578
612
  children,
579
613
  }}
580
614
  textPressabilityProps={{
@@ -600,6 +634,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
600
634
  {...restProps}
601
635
  accessibilityElementsHidden={_accessibilityElementsHidden}
602
636
  accessibilityLabel={_accessibilityLabel}
637
+ accessibilityRole={_accessibilityRole}
603
638
  accessibilityState={_accessibilityState}
604
639
  importantForAccessibility={_importantForAccessibility}
605
640
  // #[ Win32
@@ -616,7 +651,8 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
616
651
  selectable={_selectable}
617
652
  selectionColor={_selectionColor}
618
653
  style={_style}
619
- disabled={disabled}>
654
+ disabled={disabled}
655
+ role={_role}>
620
656
  {children}
621
657
  </NativeVirtualText>
622
658
  );
@@ -651,6 +687,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
651
687
  ...restProps,
652
688
  accessibilityElementsHidden: _accessibilityElementsHidden,
653
689
  accessibilityLabel: _accessibilityLabel,
690
+ accessibilityRole: _accessibilityRole,
654
691
  accessibilityState: _accessibilityState,
655
692
  accessible: _accessible,
656
693
  allowFontScaling: allowFontScaling !== false,
@@ -662,6 +699,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
662
699
  selectable: _selectable,
663
700
  selectionColor: _selectionColor,
664
701
  style: _style,
702
+ role: _role,
665
703
  children,
666
704
  }}
667
705
  textPressabilityProps={{
@@ -686,6 +724,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
686
724
  {...restProps}
687
725
  accessibilityElementsHidden={_accessibilityElementsHidden}
688
726
  accessibilityLabel={_accessibilityLabel}
727
+ accessibilityRole={_accessibilityRole}
689
728
  accessibilityState={_accessibilityState}
690
729
  accessible={_accessible}
691
730
  allowFontScaling={allowFontScaling !== false}
@@ -697,7 +736,8 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
697
736
  ref={forwardedRef}
698
737
  selectable={_selectable}
699
738
  selectionColor={_selectionColor}
700
- style={_style}>
739
+ style={_style}
740
+ role={_role}>
701
741
  {children}
702
742
  </NativeText>
703
743
  );
@@ -741,10 +781,10 @@ const TextImpl: component(
741
781
  TextImpl.displayName = 'Text';
742
782
 
743
783
  type TextPressabilityProps = $ReadOnly<{
744
- onLongPress?: ?(event: GestureResponderEvent) => mixed,
745
- onPress?: ?(event: GestureResponderEvent) => mixed,
746
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
747
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
784
+ onLongPress?: ?(event: GestureResponderEvent) => unknown,
785
+ onPress?: ?(event: GestureResponderEvent) => unknown,
786
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
787
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
748
788
  onResponderGrant?: ?(event: GestureResponderEvent) => void,
749
789
  onResponderMove?: ?(event: GestureResponderEvent) => void,
750
790
  onResponderRelease?: ?(event: GestureResponderEvent) => void,
@@ -21,7 +21,7 @@ export type NativeTextProps = $ReadOnly<{
21
21
  ...TextProps,
22
22
  isHighlighted?: ?boolean,
23
23
  selectionColor?: ?ProcessedColorValue,
24
- onClick?: ?(event: GestureResponderEvent) => mixed,
24
+ onClick?: ?(event: GestureResponderEvent) => unknown,
25
25
  // This is only needed for platforms that optimize text hit testing, e.g.,
26
26
  // react-native-windows. It can be used to only hit test virtual text spans
27
27
  // that have pressable events attached to them.
@@ -21,7 +21,7 @@ export type NativeTextProps = $ReadOnly<{
21
21
  ...TextProps,
22
22
  isHighlighted?: ?boolean,
23
23
  selectionColor?: ?ProcessedColorValue,
24
- onClick?: ?(event: GestureResponderEvent) => mixed,
24
+ onClick?: ?(event: GestureResponderEvent) => unknown,
25
25
  // This is only needed for platforms that optimize text hit testing, e.g.,
26
26
  // react-native-windows. It can be used to only hit test virtual text spans
27
27
  // that have pressable events attached to them.
@@ -122,7 +122,7 @@ export type TextPropsAndroid = {
122
122
  };
123
123
 
124
124
  type TextBaseProps = $ReadOnly<{
125
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
125
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
126
126
 
127
127
  /**
128
128
  * Whether fonts should scale to respect Text Size accessibility settings.
@@ -204,7 +204,7 @@ type TextBaseProps = $ReadOnly<{
204
204
  *
205
205
  * See https://reactnative.dev/docs/text#onlayout
206
206
  */
207
- onLayout?: ?(event: LayoutChangeEvent) => mixed,
207
+ onLayout?: ?(event: LayoutChangeEvent) => unknown,
208
208
 
209
209
  /**
210
210
  * This function is called on long press.
@@ -212,7 +212,7 @@ type TextBaseProps = $ReadOnly<{
212
212
  *
213
213
  * See https://reactnative.dev/docs/text#onlongpress
214
214
  */
215
- onLongPress?: ?(event: GestureResponderEvent) => mixed,
215
+ onLongPress?: ?(event: GestureResponderEvent) => unknown,
216
216
 
217
217
  /**
218
218
  * This function is called on press.
@@ -220,9 +220,9 @@ type TextBaseProps = $ReadOnly<{
220
220
  *
221
221
  * See https://reactnative.dev/docs/text#onpress
222
222
  */
223
- onPress?: ?(event: GestureResponderEvent) => mixed,
224
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
225
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
223
+ onPress?: ?(event: GestureResponderEvent) => unknown,
224
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
225
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
226
226
  onResponderGrant?: ?(event: GestureResponderEvent) => void,
227
227
  onResponderMove?: ?(event: GestureResponderEvent) => void,
228
228
  onResponderRelease?: ?(event: GestureResponderEvent) => void,
@@ -230,7 +230,7 @@ type TextBaseProps = $ReadOnly<{
230
230
  onResponderTerminationRequest?: ?() => boolean,
231
231
  onStartShouldSetResponder?: ?() => boolean,
232
232
  onMoveShouldSetResponder?: ?() => boolean,
233
- onTextLayout?: ?(event: TextLayoutEvent) => mixed,
233
+ onTextLayout?: ?(event: TextLayoutEvent) => unknown,
234
234
 
235
235
  /**
236
236
  * Defines how far your touch may move off of the button, before
@@ -122,7 +122,7 @@ export type TextPropsAndroid = {
122
122
  };
123
123
 
124
124
  type TextBaseProps = $ReadOnly<{
125
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
125
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
126
126
  accessibilityControls?: ?Stringish, // Win32
127
127
  accessibilityDescribedBy?: ?Stringish, // Win32
128
128
  accessibilityDescription?: ?Stringish, // Win32
@@ -218,7 +218,7 @@ type TextBaseProps = $ReadOnly<{
218
218
  *
219
219
  * See https://reactnative.dev/docs/text#onlayout
220
220
  */
221
- onLayout?: ?(event: LayoutChangeEvent) => mixed,
221
+ onLayout?: ?(event: LayoutChangeEvent) => unknown,
222
222
 
223
223
  /**
224
224
  * This function is called on long press.
@@ -226,7 +226,7 @@ type TextBaseProps = $ReadOnly<{
226
226
  *
227
227
  * See https://reactnative.dev/docs/text#onlongpress
228
228
  */
229
- onLongPress?: ?(event: GestureResponderEvent) => mixed,
229
+ onLongPress?: ?(event: GestureResponderEvent) => unknown,
230
230
 
231
231
  /**
232
232
  * This function is called on press.
@@ -234,9 +234,9 @@ type TextBaseProps = $ReadOnly<{
234
234
  *
235
235
  * See https://reactnative.dev/docs/text#onpress
236
236
  */
237
- onPress?: ?(event: GestureResponderEvent) => mixed,
238
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
239
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
237
+ onPress?: ?(event: GestureResponderEvent) => unknown,
238
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
239
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
240
240
  onResponderGrant?: ?(event: GestureResponderEvent) => void,
241
241
  onResponderMove?: ?(event: GestureResponderEvent) => void,
242
242
  onResponderRelease?: ?(event: GestureResponderEvent) => void,
@@ -244,7 +244,7 @@ type TextBaseProps = $ReadOnly<{
244
244
  onResponderTerminationRequest?: ?() => boolean,
245
245
  onStartShouldSetResponder?: ?() => boolean,
246
246
  onMoveShouldSetResponder?: ?() => boolean,
247
- onTextLayout?: ?(event: TextLayoutEvent) => mixed,
247
+ onTextLayout?: ?(event: TextLayoutEvent) => unknown,
248
248
 
249
249
  /**
250
250
  * Defines how far your touch may move off of the button, before
@@ -31,7 +31,7 @@ export type Float = number;
31
31
  export type Int32 = number;
32
32
  /* $FlowFixMe[unclear-type] Object is forbidden in strict mode */
33
33
  export type UnsafeObject = Object;
34
- export type UnsafeMixed = mixed;
34
+ export type UnsafeMixed = unknown;
35
35
 
36
36
  type DefaultTypes = number | boolean | string | $ReadOnlyArray<string>;
37
37
  // Default handling, ignore the unused value
@@ -322,3 +322,34 @@ export type MouseEvent = NativeSyntheticEvent<
322
322
  timestamp: number,
323
323
  }>,
324
324
  >;
325
+
326
+ export type KeyEvent = $ReadOnly<{
327
+ /**
328
+ * The actual key that was pressed. For example, F would be "f" or "F" depending on the shift key.
329
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
330
+ */
331
+ key: string,
332
+ /**
333
+ * The key code of the key that was pressed. For example, F would be "KeyF"
334
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
335
+ */
336
+ code: string,
337
+ altKey: boolean,
338
+ ctrlKey: boolean,
339
+ metaKey: boolean,
340
+ shiftKey: boolean,
341
+ /**
342
+ * A boolean value that is true if the given key is being held down such that it is automatically repeating.
343
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
344
+ */
345
+ repeat?: boolean,
346
+ /**
347
+ * Returns a boolean value indicating if the event is fired within a composition session
348
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/isComposing
349
+ */
350
+ isComposing?: boolean,
351
+ }>;
352
+
353
+ export type KeyUpEvent = NativeSyntheticEvent<KeyEvent>;
354
+
355
+ export type KeyDownEvent = NativeSyntheticEvent<KeyEvent>;