@office-iss/react-native-win32 0.66.2 → 0.67.0-preview.3

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 (120) hide show
  1. package/.eslintignore +2 -0
  2. package/.flowconfig +6 -1
  3. package/CHANGELOG.json +209 -33
  4. package/CHANGELOG.md +96 -20
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +14 -1
  6. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +2 -0
  7. package/Libraries/Animated/AnimatedEvent.js +23 -4
  8. package/Libraries/Animated/NativeAnimatedHelper.js +2 -2
  9. package/Libraries/Animated/components/AnimatedImage.js +3 -3
  10. package/Libraries/Animated/components/AnimatedScrollView.js +3 -3
  11. package/Libraries/Animated/components/AnimatedText.js +3 -3
  12. package/Libraries/Animated/components/AnimatedView.js +1 -3
  13. package/Libraries/Animated/createAnimatedComponent.js +3 -34
  14. package/Libraries/Components/Button/ButtonWin32.js +2 -2
  15. package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
  16. package/Libraries/Components/Button.js +3 -0
  17. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -7
  19. package/Libraries/Components/EnterString.win32.js +3 -3
  20. package/Libraries/Components/EnterString.win32.js.map +1 -1
  21. package/Libraries/Components/Pressable/Pressable.win32.js +384 -0
  22. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +1 -0
  23. package/Libraries/Components/ScrollView/ScrollView.js +17 -16
  24. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +268 -252
  25. package/Libraries/Components/Text/Tests/TextWin32Test.d.ts +0 -1
  26. package/Libraries/Components/Text/TextWin32.Props.d.ts +2 -2
  27. package/Libraries/Components/Text/TextWin32.Props.js.map +1 -1
  28. package/Libraries/Components/Text/TextWin32.js +1 -1
  29. package/Libraries/Components/Text/TextWin32.js.map +1 -1
  30. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +0 -1
  31. package/Libraries/Components/TextInput/TextInput.win32.js +6 -6
  32. package/Libraries/Components/TextInput/TextInput.win32.js.map +1 -1
  33. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +0 -1
  34. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +1 -1
  35. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  36. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +2 -2
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js.map +1 -1
  38. package/Libraries/Components/Touchable/TouchableWin32.js +2 -2
  39. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  40. package/Libraries/Components/View/Tests/ViewWin32Test.d.ts +0 -1
  41. package/Libraries/Components/View/View.js +1 -1
  42. package/Libraries/Components/View/View.win32.js +59 -3
  43. package/Libraries/Components/View/ViewAccessibility.js +1 -1
  44. package/Libraries/Components/View/ViewPropTypes.win32.js +546 -0
  45. package/Libraries/Components/View/ViewWin32.Props.d.ts +3 -6
  46. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  47. package/Libraries/Components/View/ViewWin32.js +5 -5
  48. package/Libraries/Components/View/ViewWin32.js.map +1 -1
  49. package/Libraries/Core/ExceptionsManager.js +45 -80
  50. package/Libraries/Core/ExtendedError.js +0 -1
  51. package/Libraries/Core/ReactNativeVersion.js +2 -2
  52. package/Libraries/Core/setUpBatchedBridge.js +1 -1
  53. package/Libraries/Core/setUpGlobals.js +2 -4
  54. package/Libraries/Core/setUpTimers.js +2 -2
  55. package/Libraries/Image/Image.ios.js +6 -0
  56. package/Libraries/Image/Image.win32.js +6 -0
  57. package/Libraries/Image/ImageBackground.js +10 -8
  58. package/Libraries/Image/ImageProps.js +28 -0
  59. package/Libraries/Image/Tests/ImageWin32Test.d.ts +0 -1
  60. package/Libraries/LogBox/Data/LogBoxData.js +18 -19
  61. package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
  62. package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
  63. package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
  64. package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
  65. package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
  66. package/Libraries/NewAppScreen/components/logo.png +0 -0
  67. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +2 -1
  68. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +2 -0
  69. package/Libraries/PersonaCoin/PersonaCoin.js +3 -2
  70. package/Libraries/PersonaCoin/PersonaCoin.js.map +1 -1
  71. package/Libraries/Pressability/HoverState.win32.js +60 -0
  72. package/Libraries/Pressability/Pressability.js +13 -13
  73. package/Libraries/Pressability/Pressability.win32.js +962 -0
  74. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
  75. package/Libraries/ReactNative/AppRegistry.js +4 -2
  76. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +1569 -875
  77. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +529 -319
  78. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +570 -362
  79. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +1592 -891
  80. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +521 -311
  81. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +562 -354
  82. package/Libraries/Share/Share.js +1 -1
  83. package/Libraries/StyleSheet/normalizeColor.js +2 -2
  84. package/Libraries/Text/TextProps.js +1 -7
  85. package/Libraries/TurboModule/TurboModuleRegistry.js +1 -1
  86. package/Libraries/Types/CoreEventTypes.win32.js +191 -0
  87. package/Libraries/Utilities/HMRClient.js +1 -1
  88. package/flow/global.js +45 -0
  89. package/index.js +15 -10
  90. package/index.win32.js +15 -10
  91. package/jest/mockModal.js +31 -0
  92. package/jest/setup.js +5 -3
  93. package/overrides.json +42 -13
  94. package/package.json +20 -18
  95. package/rntypes/BatchedBridge.d.ts +23 -0
  96. package/rntypes/Devtools.d.ts +20 -0
  97. package/rntypes/LaunchScreen.d.ts +9 -0
  98. package/rntypes/globals.d.ts +496 -0
  99. package/rntypes/index.d.ts +9966 -0
  100. package/rntypes/legacy-properties.d.ts +266 -0
  101. package/src/Libraries/Components/Text/TextWin32.Props.ts +2 -2
  102. package/src/Libraries/Components/View/ViewWin32.Props.ts +6 -12
  103. package/src/rntypes/BatchedBridge.d.ts +23 -0
  104. package/src/rntypes/Devtools.d.ts +20 -0
  105. package/src/rntypes/LaunchScreen.d.ts +9 -0
  106. package/src/rntypes/globals.d.ts +496 -0
  107. package/src/rntypes/index.d.ts +9966 -0
  108. package/src/rntypes/legacy-properties.d.ts +266 -0
  109. package/src/typings-index.ts +11 -4
  110. package/typings-index.d.ts +3 -1
  111. package/typings-index.js +7 -5
  112. package/typings-index.js.map +1 -1
  113. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
  114. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
  115. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.win32.js +0 -30
  116. package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
  117. package/Libraries/Components/StaticContainer.react.js +0 -51
  118. package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -25
  119. package/Libraries/Interaction/InteractionMixin.js +0 -54
  120. package/Libraries/ReactNative/queryLayoutByID.js +0 -58
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ import Platform from '../Utilities/Platform';
12
+
13
+ let isEnabled = false;
14
+
15
+ if (Platform.OS === 'web') {
16
+ const canUseDOM = Boolean(
17
+ typeof window !== 'undefined' &&
18
+ window.document &&
19
+ window.document.createElement,
20
+ );
21
+
22
+ if (canUseDOM) {
23
+ /**
24
+ * Web browsers emulate mouse events (and hover states) after touch events.
25
+ * This code infers when the currently-in-use modality supports hover
26
+ * (including for multi-modality devices) and considers "hover" to be enabled
27
+ * if a mouse movement occurs more than 1 second after the last touch event.
28
+ * This threshold is long enough to account for longer delays between the
29
+ * browser firing touch and mouse events on low-powered devices.
30
+ */
31
+ const HOVER_THRESHOLD_MS = 1000;
32
+ let lastTouchTimestamp = 0;
33
+
34
+ const enableHover = () => {
35
+ if (isEnabled || Date.now() - lastTouchTimestamp < HOVER_THRESHOLD_MS) {
36
+ return;
37
+ }
38
+ isEnabled = true;
39
+ };
40
+
41
+ const disableHover = () => {
42
+ lastTouchTimestamp = Date.now();
43
+ if (isEnabled) {
44
+ isEnabled = false;
45
+ }
46
+ };
47
+
48
+ document.addEventListener('touchstart', disableHover, true);
49
+ document.addEventListener('touchmove', disableHover, true);
50
+ document.addEventListener('mousemove', enableHover, true);
51
+ }
52
+ // [Windows
53
+ } else if (Platform.OS === 'windows' || Platform.OS === 'win32') {
54
+ isEnabled = true;
55
+ // Windows]
56
+ }
57
+
58
+ export function isHoverEnabled(): boolean {
59
+ return isEnabled;
60
+ }
@@ -608,6 +608,19 @@ export default class Pressability {
608
608
  * and stores the new state. Validates the transition as well.
609
609
  */
610
610
  _receiveSignal(signal: TouchSignal, event: PressEvent): void {
611
+ // Especially on iOS, not all events have timestamps associated.
612
+ // For telemetry purposes, this doesn't matter too much, as long as *some* do.
613
+ // Since the native timestamp is integral for logging telemetry, just skip
614
+ // events if they don't have a timestamp attached.
615
+ if (event.nativeEvent.timestamp != null) {
616
+ PressabilityPerformanceEventEmitter.emitEvent(() => {
617
+ return {
618
+ signal,
619
+ nativeTimestamp: event.nativeEvent.timestamp,
620
+ };
621
+ });
622
+ }
623
+
611
624
  const prevState = this._touchState;
612
625
  const nextState = Transitions[prevState]?.[signal];
613
626
  if (this._responderID == null && signal === 'RESPONDER_RELEASE') {
@@ -623,19 +636,6 @@ export default class Pressability {
623
636
  : '<<host component>>',
624
637
  );
625
638
  if (prevState !== nextState) {
626
- // Especially on iOS, not all events have timestamps associated.
627
- // For telemetry purposes, this doesn't matter too much, as long as *some* do.
628
- // Since the native timestamp is integral for logging telemetry, just skip
629
- // events if they don't have a timestamp attached.
630
- if (event.nativeEvent.timestamp != null) {
631
- PressabilityPerformanceEventEmitter.emitEvent(() => {
632
- return {
633
- signal,
634
- touchDelayMs: Date.now() - event.nativeEvent.timestamp,
635
- };
636
- });
637
- }
638
-
639
639
  this._performTransitionSideEffects(prevState, nextState, signal, event);
640
640
  this._touchState = nextState;
641
641
  }