@office-iss/react-native-win32 0.0.0-canary.299 → 0.0.0-canary.300

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 +3 -6
  2. package/CHANGELOG.json +46 -1
  3. package/CHANGELOG.md +19 -6
  4. package/IntegrationTests/IntegrationTestsApp.js +1 -1
  5. package/Libraries/Alert/RCTAlertManager.android.js +2 -0
  6. package/Libraries/Animated/Animated.d.ts +2 -0
  7. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  8. package/Libraries/Animated/Easing.js +2 -0
  9. package/Libraries/Animated/animations/Animation.js +14 -14
  10. package/Libraries/Animated/animations/TimingAnimation.js +2 -0
  11. package/Libraries/Animated/nodes/AnimatedNode.js +7 -7
  12. package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
  13. package/Libraries/Animated/nodes/AnimatedProps.js +30 -30
  14. package/Libraries/Animated/nodes/AnimatedStyle.js +17 -17
  15. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
  16. package/Libraries/Animated/nodes/AnimatedValue.js +18 -18
  17. package/Libraries/AppState/AppState.js +3 -3
  18. package/Libraries/BatchedBridge/MessageQueue.js +4 -0
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  20. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  21. package/Libraries/Components/Pressable/Pressable.js +10 -1
  22. package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
  23. package/Libraries/Components/StatusBar/StatusBar.js +2 -2
  24. package/Libraries/Components/Switch/Switch.js +1 -1
  25. package/Libraries/Components/TextInput/TextInput.js +2 -2
  26. package/Libraries/Components/TextInput/TextInput.win32.js +2 -1
  27. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  28. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  29. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  30. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
  31. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
  32. package/Libraries/Components/View/View.js +86 -168
  33. package/Libraries/Core/ReactNativeVersion.js +37 -10
  34. package/Libraries/Core/Timers/queueMicrotask.js +1 -0
  35. package/Libraries/Core/setUpPerformance.js +2 -1
  36. package/Libraries/Interaction/InteractionManager.js +118 -171
  37. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
  38. package/Libraries/LogBox/Data/LogBoxData.js +4 -1
  39. package/Libraries/Modal/Modal.js +1 -1
  40. package/Libraries/NativeComponent/ViewConfig.js +1 -1
  41. package/Libraries/Network/XMLHttpRequest.js +18 -5
  42. package/Libraries/Pressability/Pressability.js +1 -1
  43. package/Libraries/Pressability/Pressability.win32.js +1 -1
  44. package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
  45. package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
  46. package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
  47. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
  48. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
  49. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
  50. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
  51. package/Libraries/Renderer/shims/ReactFabric.js +3 -1
  52. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  53. package/Libraries/Renderer/shims/ReactNative.js +3 -1
  54. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  55. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  56. package/Libraries/Utilities/useMergeRefs.js +1 -1
  57. package/Libraries/promiseRejectionTrackingOptions.js +17 -31
  58. package/flow/HermesInternalType.js +114 -0
  59. package/flow/Stringish.js +14 -0
  60. package/flow/bom.js.flow +554 -0
  61. package/flow/console.js +49 -0
  62. package/flow/cssom.js.flow +575 -0
  63. package/flow/dom.js.flow +6289 -0
  64. package/flow/global.js +88 -0
  65. package/flow/prettier.js.flow +14 -0
  66. package/flow/streams.js.flow +140 -0
  67. package/index.js +5 -2
  68. package/index.win32.js +6 -2
  69. package/jest/mockComponent.js +1 -1
  70. package/jest/setup.js +11 -0
  71. package/overrides.json +11 -11
  72. package/package.json +19 -19
  73. package/src/private/animated/NativeAnimatedHelper.js +8 -1
  74. package/src/private/animated/NativeAnimatedHelper.win32.js +8 -1
  75. package/src/private/animated/createAnimatedPropsHook.js +2 -49
  76. package/src/private/animated/createAnimatedPropsMemoHook.js +2 -48
  77. package/src/private/components/virtualview/VirtualView.js +22 -6
  78. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
  79. package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
  80. package/src/private/featureflags/ReactNativeFeatureFlags.js +71 -51
  81. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +19 -0
  82. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -5
  83. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  84. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +2 -2
  85. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  86. package/src/private/webapis/geometry/DOMRectList.js +2 -2
  87. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
  88. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
  89. package/src/private/webapis/performance/EventTiming.js +5 -9
  90. package/src/private/webapis/performance/Performance.js +251 -191
  91. package/src/private/webapis/performance/PerformanceObserver.js +8 -29
  92. package/src/private/webapis/performance/UserTiming.js +24 -23
  93. package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
  94. package/src/private/webapis/performance/internals/Utilities.js +9 -0
  95. package/src/private/webapis/performance/specs/NativePerformance.js +19 -33
  96. package/src/private/webapis/structuredClone/structuredClone.js +1 -1
  97. package/Libraries/Interaction/InteractionManagerStub.js +0 -184
  98. package/Libraries/Interaction/TaskQueue.js +0 -197
  99. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
@@ -18,7 +18,7 @@ import {setPlatformObject} from '../../webidl/PlatformObjects';
18
18
  // IMPORTANT: The type definition for this module is defined in `HTMLCollection.js.flow`
19
19
  // because Flow only supports indexers in classes in declaration files.
20
20
 
21
- // $FlowIssue[prop-missing] Flow doesn't understand [Symbol.iterator]() {} and thinks this class doesn't implement the Iterable<T> interface.
21
+ // $FlowFixMe[prop-missing] Flow doesn't understand [Symbol.iterator]() {} and thinks this class doesn't implement the Iterable<T> interface.
22
22
  export default class HTMLCollection<T> implements Iterable<T>, ArrayLike<T> {
23
23
  #length: number;
24
24
 
@@ -64,7 +64,7 @@ export default class HTMLCollection<T> implements Iterable<T>, ArrayLike<T> {
64
64
  return null;
65
65
  }
66
66
 
67
- // $FlowIssue[unsupported-syntax] Flow does not support computed properties in classes.
67
+ // $FlowFixMe[unsupported-syntax] Flow does not support computed properties in classes.
68
68
  [Symbol.iterator](): Iterator<T> {
69
69
  return createValueIterator(this);
70
70
  }
@@ -22,7 +22,7 @@ import {setPlatformObject} from '../../webidl/PlatformObjects';
22
22
  // IMPORTANT: The Flow type definition for this module is defined in `NodeList.js.flow`
23
23
  // because Flow only supports indexers in classes in declaration files.
24
24
 
25
- // $FlowIssue[prop-missing] Flow doesn't understand [Symbol.iterator]() {} and thinks this class doesn't implement the Iterable<T> interface.
25
+ // $FlowFixMe[prop-missing] Flow doesn't understand [Symbol.iterator]() {} and thinks this class doesn't implement the Iterable<T> interface.
26
26
  export default class NodeList<T> implements Iterable<T>, ArrayLike<T> {
27
27
  #length: number;
28
28
 
@@ -88,7 +88,7 @@ export default class NodeList<T> implements Iterable<T>, ArrayLike<T> {
88
88
  return createValueIterator(this);
89
89
  }
90
90
 
91
- // $FlowIssue[unsupported-syntax] Flow does not support computed properties in classes.
91
+ // $FlowFixMe[unsupported-syntax] Flow does not support computed properties in classes.
92
92
  [Symbol.iterator](): Iterator<T> {
93
93
  return createValueIterator(this);
94
94
  }
@@ -19,7 +19,7 @@ import {setPlatformObject} from '../webidl/PlatformObjects';
19
19
  // IMPORTANT: The Flow type definition for this module is defined in `DOMRectList.js.flow`
20
20
  // because Flow only supports indexers in classes in declaration files.
21
21
 
22
- // $FlowIssue[prop-missing] Flow doesn't understand [Symbol.iterator]() {} and thinks this class doesn't implement the Iterable interface.
22
+ // $FlowFixMe[prop-missing] Flow doesn't understand [Symbol.iterator]() {} and thinks this class doesn't implement the Iterable interface.
23
23
  export default class DOMRectList implements Iterable<DOMRectReadOnly> {
24
24
  #length: number;
25
25
 
@@ -58,7 +58,7 @@ export default class DOMRectList implements Iterable<DOMRectReadOnly> {
58
58
  return arrayLike[index];
59
59
  }
60
60
 
61
- // $FlowIssue[unsupported-syntax] Flow does not support computed properties in classes.
61
+ // $FlowFixMe[unsupported-syntax] Flow does not support computed properties in classes.
62
62
  [Symbol.iterator](): Iterator<DOMRectReadOnly> {
63
63
  return createValueIterator(this);
64
64
  }
@@ -27,13 +27,13 @@ import type {NativeIntersectionObserverToken} from '../specs/NativeIntersectionO
27
27
 
28
28
  import * as Systrace from '../../../../../Libraries/Performance/Systrace';
29
29
  import warnOnce from '../../../../../Libraries/Utilities/warnOnce';
30
- import * as ReactNativeFeatureFlags from '../../../featureflags/ReactNativeFeatureFlags';
31
30
  import {
32
31
  getInstanceHandle,
33
32
  getNativeNodeReference,
34
33
  } from '../../dom/nodes/internals/NodeInternals';
35
34
  import {createIntersectionObserverEntry} from '../IntersectionObserverEntry';
36
35
  import NativeIntersectionObserver from '../specs/NativeIntersectionObserver';
36
+ import nullthrows from 'nullthrows';
37
37
 
38
38
  export type IntersectionObserverId = number;
39
39
 
@@ -69,36 +69,11 @@ function setTargetForInstanceHandle(
69
69
  instanceHandleToTargetMap.set(key, target);
70
70
  }
71
71
 
72
- // The mapping between ReactNativeElement and their corresponding shadow node
73
- // also needs to be kept here because React removes the link when unmounting.
74
- const targetToShadowNodeMap: WeakMap<
75
- ReactNativeElement,
76
- ReturnType<typeof getNativeNodeReference>,
77
- > = new WeakMap();
78
-
79
72
  const targetToTokenMap: WeakMap<
80
73
  ReactNativeElement,
81
74
  NativeIntersectionObserverToken,
82
75
  > = new WeakMap();
83
76
 
84
- let modernNativeIntersectionObserver =
85
- NativeIntersectionObserver == null
86
- ? null
87
- : NativeIntersectionObserver.observeV2 == null ||
88
- NativeIntersectionObserver.unobserveV2 == null
89
- ? null
90
- : {
91
- observe: NativeIntersectionObserver.observeV2,
92
- unobserve: NativeIntersectionObserver.unobserveV2,
93
- };
94
-
95
- if (
96
- modernNativeIntersectionObserver &&
97
- !ReactNativeFeatureFlags.utilizeTokensInIntersectionObserver()
98
- ) {
99
- modernNativeIntersectionObserver = null;
100
- }
101
-
102
77
  /**
103
78
  * Registers the given intersection observer and returns a unique ID for it,
104
79
  * which is required to start observing targets.
@@ -189,34 +164,19 @@ export function observe({
189
164
  // access it even after the instance handle has been unmounted.
190
165
  setTargetForInstanceHandle(instanceHandle, target);
191
166
 
192
- if (modernNativeIntersectionObserver == null) {
193
- // Same for the mapping between the target and its shadow node.
194
- targetToShadowNodeMap.set(target, targetNativeNodeReference);
195
- }
196
-
197
167
  if (!isConnected) {
198
168
  NativeIntersectionObserver.connect(notifyIntersectionObservers);
199
169
  isConnected = true;
200
170
  }
201
171
 
202
- if (modernNativeIntersectionObserver == null) {
203
- NativeIntersectionObserver.observe({
204
- intersectionObserverId,
205
- rootShadowNode: rootNativeNodeReference,
206
- targetShadowNode: targetNativeNodeReference,
207
- thresholds: registeredObserver.observer.thresholds,
208
- rootThresholds: registeredObserver.observer.rnRootThresholds,
209
- });
210
- } else {
211
- const token = modernNativeIntersectionObserver.observe({
212
- intersectionObserverId,
213
- rootShadowNode: rootNativeNodeReference,
214
- targetShadowNode: targetNativeNodeReference,
215
- thresholds: registeredObserver.observer.thresholds,
216
- rootThresholds: registeredObserver.observer.rnRootThresholds,
217
- });
218
- targetToTokenMap.set(target, token);
219
- }
172
+ const token = nullthrows(NativeIntersectionObserver.observeV2)({
173
+ intersectionObserverId,
174
+ rootShadowNode: rootNativeNodeReference,
175
+ targetShadowNode: targetNativeNodeReference,
176
+ thresholds: registeredObserver.observer.thresholds,
177
+ rootThresholds: registeredObserver.observer.rnRootThresholds,
178
+ });
179
+ targetToTokenMap.set(target, token);
220
180
 
221
181
  return true;
222
182
  }
@@ -240,33 +200,18 @@ export function unobserve(
240
200
  return;
241
201
  }
242
202
 
243
- if (modernNativeIntersectionObserver == null) {
244
- const targetNativeNodeReference = targetToShadowNodeMap.get(target);
245
- if (targetNativeNodeReference == null) {
246
- console.error(
247
- 'IntersectionObserverManager: could not find registration data for target',
248
- );
249
- return;
250
- }
251
-
252
- NativeIntersectionObserver.unobserve(
253
- intersectionObserverId,
254
- targetNativeNodeReference,
255
- );
256
- } else {
257
- const targetToken = targetToTokenMap.get(target);
258
- if (targetToken == null) {
259
- console.error(
260
- 'IntersectionObserverManager: could not find registration data for target',
261
- );
262
- return;
263
- }
264
-
265
- modernNativeIntersectionObserver.unobserve(
266
- intersectionObserverId,
267
- targetToken,
203
+ const targetToken = targetToTokenMap.get(target);
204
+ if (targetToken == null) {
205
+ console.error(
206
+ 'IntersectionObserverManager: could not find registration data for target',
268
207
  );
208
+ return;
269
209
  }
210
+
211
+ nullthrows(NativeIntersectionObserver.unobserveV2)(
212
+ intersectionObserverId,
213
+ targetToken,
214
+ );
270
215
  }
271
216
 
272
217
  /**
@@ -34,10 +34,6 @@ export type NativeIntersectionObserverObserveOptions = {
34
34
  export opaque type NativeIntersectionObserverToken = mixed;
35
35
 
36
36
  export interface Spec extends TurboModule {
37
- // TODO(T223605846): Remove legacy observe method
38
- +observe: (options: NativeIntersectionObserverObserveOptions) => void;
39
- // TODO(T223605846): Remove legacy unobserve method
40
- +unobserve: (intersectionObserverId: number, targetShadowNode: mixed) => void;
41
37
  +observeV2?: (
42
38
  options: NativeIntersectionObserverObserveOptions,
43
39
  ) => NativeIntersectionObserverToken;
@@ -15,9 +15,11 @@ import type {
15
15
  PerformanceEntryJSON,
16
16
  } from './PerformanceEntry';
17
17
 
18
- import {warnNoNativePerformance} from './internals/Utilities';
19
18
  import {PerformanceEntry} from './PerformanceEntry';
20
- import NativePerformance from './specs/NativePerformance';
19
+ import MaybeNativePerformance from './specs/NativePerformance';
20
+ import nullthrows from 'nullthrows';
21
+
22
+ const NativePerformance = nullthrows(MaybeNativePerformance);
21
23
 
22
24
  export type PerformanceEventTimingJSON = {
23
25
  ...PerformanceEntryJSON,
@@ -86,14 +88,8 @@ function getCachedEventCounts(): Map<string, number> {
86
88
  return cachedEventCounts;
87
89
  }
88
90
 
89
- if (!NativePerformance || !NativePerformance?.getEventCounts) {
90
- warnNoNativePerformance();
91
- cachedEventCounts = new Map();
92
- return cachedEventCounts;
93
- }
94
-
95
91
  const eventCounts = new Map<string, number>(
96
- NativePerformance.getEventCounts?.() ?? [],
92
+ NativePerformance.getEventCounts() ?? [],
97
93
  );
98
94
  cachedEventCounts = eventCounts;
99
95