@office-iss/react-native-win32 0.0.0-canary.276 → 0.0.0-canary.278

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 (48) hide show
  1. package/.flowconfig +2 -1
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Animated/NativeAnimatedAllowlist.js +4 -4
  5. package/Libraries/Animated/animations/Animation.js +13 -1
  6. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  7. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  8. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  9. package/Libraries/Animated/nodes/AnimatedAddition.js +8 -2
  10. package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
  11. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +9 -2
  12. package/Libraries/Animated/nodes/AnimatedDivision.js +8 -2
  13. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -1
  14. package/Libraries/Animated/nodes/AnimatedModulo.js +4 -2
  15. package/Libraries/Animated/nodes/AnimatedMultiplication.js +8 -2
  16. package/Libraries/Animated/nodes/AnimatedNode.js +25 -0
  17. package/Libraries/Animated/nodes/AnimatedObject.js +8 -2
  18. package/Libraries/Animated/nodes/AnimatedProps.js +13 -2
  19. package/Libraries/Animated/nodes/AnimatedStyle.js +13 -2
  20. package/Libraries/Animated/nodes/AnimatedSubtraction.js +8 -2
  21. package/Libraries/Animated/nodes/AnimatedTracking.js +4 -1
  22. package/Libraries/Animated/nodes/AnimatedTransform.js +4 -1
  23. package/Libraries/Animated/nodes/AnimatedValue.js +4 -1
  24. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  25. package/Libraries/Core/ReactNativeVersion.js +2 -2
  26. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  27. package/Libraries/Network/FormData.js +11 -3
  28. package/Libraries/Text/Text.d.ts +6 -1
  29. package/Libraries/Text/TextProps.js +2 -2
  30. package/Libraries/Text/TextProps.win32.js +2 -2
  31. package/overrides.json +4 -4
  32. package/package.json +10 -11
  33. package/src/private/animated/useAnimatedPropsMemo.js +12 -4
  34. package/src/private/featureflags/ReactNativeFeatureFlags.js +18 -7
  35. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
  36. package/src/private/webapis/dom/nodes/ReactNativeElement.js +48 -6
  37. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +3 -1
  38. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  39. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  40. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  41. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  42. package/src/private/webapis/performance/Performance.js +0 -12
  43. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  44. package/src-win/Libraries/Text/Text.d.ts +6 -1
  45. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  46. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  47. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  48. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -115,9 +115,6 @@ export default class Performance {
115
115
  markName,
116
116
  markOptions?.startTime,
117
117
  );
118
- } else if (NativePerformance?.mark) {
119
- computedStartTime = markOptions?.startTime ?? performance.now();
120
- NativePerformance?.mark?.(markName, computedStartTime);
121
118
  } else {
122
119
  warnNoNativePerformance();
123
120
  computedStartTime = performance.now();
@@ -203,15 +200,6 @@ export default class Performance {
203
200
  startMarkName,
204
201
  endMarkName,
205
202
  );
206
- } else if (NativePerformance?.measure) {
207
- NativePerformance.measure(
208
- measureName,
209
- startTime,
210
- endTime,
211
- duration,
212
- startMarkName,
213
- endMarkName,
214
- );
215
203
  } else {
216
204
  warnNoNativePerformance();
217
205
  }
@@ -45,17 +45,6 @@ export type PerformanceObserverInit = {
45
45
 
46
46
  export interface Spec extends TurboModule {
47
47
  +now?: () => number;
48
- // TODO: remove when `markWithResult` is fully rolled out.
49
- +mark?: (name: string, startTime: number) => void;
50
- // TODO: remove when `measureWithResult` is fully rolled out.
51
- +measure?: (
52
- name: string,
53
- startTime: number,
54
- endTime: number,
55
- duration?: number,
56
- startMark?: string,
57
- endMark?: string,
58
- ) => void;
59
48
  +markWithResult?: (
60
49
  name: string,
61
50
  startTime?: number,
@@ -12,7 +12,7 @@ import {Constructor} from '../../types/private/Utilities';
12
12
  import {AccessibilityProps} from '../Components/View/ViewAccessibility';
13
13
  import {NativeMethods} from '../../types/public/ReactNativeTypes';
14
14
  import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
15
- import {TextStyle} from '../StyleSheet/StyleSheetTypes';
15
+ import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
16
16
  import {
17
17
  GestureResponderEvent,
18
18
  LayoutChangeEvent,
@@ -294,6 +294,11 @@ export interface TextProps
294
294
  * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
295
295
  */
296
296
  minimumFontScale?: number | undefined;
297
+
298
+ /**
299
+ * Controls how touch events are handled. Similar to `View`'s `pointerEvents`.
300
+ */
301
+ pointerEvents?: ViewStyle['pointerEvents'] | undefined;
297
302
  }
298
303
 
299
304
  /**
@@ -1,334 +0,0 @@
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
- * @flow strict-local
8
- * @format
9
- * @oncall react_native
10
- */
11
-
12
- import type {
13
- InternalInstanceHandle,
14
- LayoutAnimationConfig,
15
- MeasureInWindowOnSuccessCallback,
16
- MeasureLayoutOnSuccessCallback,
17
- MeasureOnSuccessCallback,
18
- Node,
19
- } from '../../Renderer/shims/ReactNativeTypes';
20
- import type {RootTag} from '../../Types/RootTagTypes';
21
- import type {
22
- NodeProps,
23
- NodeSet,
24
- Spec as FabricUIManager,
25
- } from '../FabricUIManager';
26
-
27
- import {createRootTag} from '../RootTag.js';
28
-
29
- export type NodeMock = {
30
- children: NodeSet,
31
- instanceHandle: InternalInstanceHandle,
32
- props: NodeProps,
33
- reactTag: number,
34
- rootTag: RootTag,
35
- viewName: string,
36
- };
37
-
38
- export function fromNode(node: Node): NodeMock {
39
- // $FlowExpectedError[incompatible-return]
40
- return node;
41
- }
42
-
43
- export function toNode(node: NodeMock): Node {
44
- // $FlowExpectedError[incompatible-return]
45
- return node;
46
- }
47
-
48
- // Mock of the Native Hooks
49
-
50
- const roots: Map<RootTag, NodeSet> = new Map();
51
- const allocatedTags: Set<number> = new Set();
52
-
53
- export function ensureHostNode(node: Node): void {
54
- if (node == null || typeof node !== 'object') {
55
- throw new Error(
56
- `Expected node to be an object. Got ${
57
- node === null ? 'null' : typeof node
58
- } value`,
59
- );
60
- }
61
-
62
- if (typeof node.viewName !== 'string') {
63
- throw new Error(
64
- `Expected node to be a host node. Got object with ${
65
- node.viewName === null ? 'null' : typeof node.viewName
66
- } viewName`,
67
- );
68
- }
69
- }
70
-
71
- function getAncestorsInChildSet(
72
- node: Node,
73
- childSet: NodeSet,
74
- ): ?$ReadOnlyArray<[Node, number]> {
75
- const rootNode = toNode({
76
- reactTag: 0,
77
- rootTag: fromNode(node).rootTag,
78
- viewName: 'RootNode',
79
- // $FlowExpectedError
80
- instanceHandle: null,
81
- props: {},
82
- children: childSet,
83
- });
84
-
85
- let position = 0;
86
- for (const child of childSet) {
87
- const ancestors = getAncestors(child, node);
88
- if (ancestors) {
89
- return [[rootNode, position]].concat(ancestors);
90
- }
91
- position++;
92
- }
93
-
94
- return null;
95
- }
96
-
97
- export function getAncestorsInCurrentTree(
98
- node: Node,
99
- ): ?$ReadOnlyArray<[Node, number]> {
100
- const childSet = roots.get(fromNode(node).rootTag);
101
- if (childSet == null) {
102
- return null;
103
- }
104
-
105
- return getAncestorsInChildSet(node, childSet);
106
- }
107
-
108
- function getAncestors(root: Node, node: Node): ?$ReadOnlyArray<[Node, number]> {
109
- if (fromNode(root).reactTag === fromNode(node).reactTag) {
110
- return [];
111
- }
112
-
113
- let position = 0;
114
- for (const child of fromNode(root).children) {
115
- const ancestors = getAncestors(child, node);
116
- if (ancestors != null) {
117
- return [[root, position]].concat(ancestors);
118
- }
119
- position++;
120
- }
121
-
122
- return null;
123
- }
124
-
125
- export function getNodeInChildSet(node: Node, childSet: NodeSet): ?Node {
126
- const ancestors = getAncestorsInChildSet(node, childSet);
127
- if (ancestors == null) {
128
- return null;
129
- }
130
-
131
- const [parent, position] = ancestors[ancestors.length - 1];
132
- const nodeInCurrentTree = fromNode(parent).children[position];
133
- return nodeInCurrentTree;
134
- }
135
-
136
- export function getNodeInCurrentTree(node: Node): ?Node {
137
- const childSet = roots.get(fromNode(node).rootTag);
138
- if (childSet == null) {
139
- return null;
140
- }
141
-
142
- return getNodeInChildSet(node, childSet);
143
- }
144
-
145
- interface IFabricUIManagerMock extends FabricUIManager {
146
- getRoot(rootTag: RootTag | number): NodeSet;
147
- __getInstanceHandleFromNode(node: Node): InternalInstanceHandle;
148
- __addCommitHook(commitHook: UIManagerCommitHook): void;
149
- __removeCommitHook(commitHook: UIManagerCommitHook): void;
150
- }
151
-
152
- export interface UIManagerCommitHook {
153
- shadowTreeWillCommit: (
154
- rootTag: RootTag,
155
- oldChildSet: ?NodeSet,
156
- newChildSet: NodeSet,
157
- ) => void;
158
- }
159
-
160
- const commitHooks: Set<UIManagerCommitHook> = new Set();
161
-
162
- const FabricUIManagerMock: IFabricUIManagerMock = {
163
- createNode: jest.fn(
164
- (
165
- reactTag: number,
166
- viewName: string,
167
- rootTag: RootTag,
168
- props: NodeProps,
169
- instanceHandle: InternalInstanceHandle,
170
- ): Node => {
171
- if (allocatedTags.has(reactTag)) {
172
- throw new Error(`Created two native views with tag ${reactTag}`);
173
- }
174
-
175
- allocatedTags.add(reactTag);
176
- return toNode({
177
- reactTag,
178
- rootTag,
179
- viewName,
180
- instanceHandle,
181
- props: props,
182
- children: [],
183
- });
184
- },
185
- ),
186
-
187
- cloneNode: jest.fn((node: Node): Node => {
188
- return toNode({...fromNode(node)});
189
- }),
190
-
191
- cloneNodeWithNewChildren: jest.fn((node: Node): Node => {
192
- return toNode({...fromNode(node), children: []});
193
- }),
194
-
195
- cloneNodeWithNewProps: jest.fn((node: Node, newProps: NodeProps): Node => {
196
- return toNode({
197
- ...fromNode(node),
198
- props: {
199
- ...fromNode(node).props,
200
- ...newProps,
201
- },
202
- });
203
- }),
204
-
205
- cloneNodeWithNewChildrenAndProps: jest.fn(
206
- (node: Node, newProps: NodeProps): Node => {
207
- return toNode({
208
- ...fromNode(node),
209
- children: [],
210
- props: {
211
- ...fromNode(node).props,
212
- ...newProps,
213
- },
214
- });
215
- },
216
- ),
217
-
218
- createChildSet: jest.fn((rootTag: RootTag): NodeSet => {
219
- return [];
220
- }),
221
-
222
- appendChild: jest.fn((parentNode: Node, child: Node): Node => {
223
- // Although the signature returns a Node, React expects this to be mutating.
224
- fromNode(parentNode).children.push(child);
225
- return parentNode;
226
- }),
227
-
228
- appendChildToSet: jest.fn((childSet: NodeSet, child: Node): void => {
229
- childSet.push(child);
230
- }),
231
-
232
- completeRoot: jest.fn((rootTag: RootTag, childSet: NodeSet): void => {
233
- commitHooks.forEach(hook =>
234
- hook.shadowTreeWillCommit(rootTag, roots.get(rootTag), childSet),
235
- );
236
- roots.set(rootTag, childSet);
237
- }),
238
-
239
- measure: jest.fn((node: Node, callback: MeasureOnSuccessCallback): void => {
240
- ensureHostNode(node);
241
-
242
- callback(10, 10, 100, 100, 0, 0);
243
- }),
244
-
245
- measureInWindow: jest.fn(
246
- (node: Node, callback: MeasureInWindowOnSuccessCallback): void => {
247
- ensureHostNode(node);
248
-
249
- callback(10, 10, 100, 100);
250
- },
251
- ),
252
-
253
- measureLayout: jest.fn(
254
- (
255
- node: Node,
256
- relativeNode: Node,
257
- onFail: () => void,
258
- onSuccess: MeasureLayoutOnSuccessCallback,
259
- ): void => {
260
- ensureHostNode(node);
261
- ensureHostNode(relativeNode);
262
-
263
- onSuccess(1, 1, 100, 100);
264
- },
265
- ),
266
-
267
- configureNextLayoutAnimation: jest.fn(
268
- (
269
- config: LayoutAnimationConfig,
270
- callback: () => void, // check what is returned here
271
- errorCallback: () => void,
272
- ): void => {},
273
- ),
274
-
275
- sendAccessibilityEvent: jest.fn((node: Node, eventType: string): void => {}),
276
-
277
- findShadowNodeByTag_DEPRECATED: jest.fn((reactTag: number): ?Node => {}),
278
-
279
- findNodeAtPoint: jest.fn(
280
- (
281
- node: Node,
282
- locationX: number,
283
- locationY: number,
284
- callback: (instanceHandle: ?InternalInstanceHandle) => void,
285
- ): void => {},
286
- ),
287
-
288
- getBoundingClientRect: jest.fn(
289
- (
290
- node: Node,
291
- includeTransform: boolean,
292
- ): ?[
293
- /* x:*/ number,
294
- /* y:*/ number,
295
- /* width:*/ number,
296
- /* height:*/ number,
297
- ] => {},
298
- ),
299
-
300
- setNativeProps: jest.fn((node: Node, newProps: NodeProps): void => {}),
301
-
302
- dispatchCommand: jest.fn(
303
- (node: Node, commandName: string, args: Array<mixed>): void => {},
304
- ),
305
-
306
- compareDocumentPosition: jest.fn((node: Node, otherNode: Node): number => 0),
307
-
308
- getRoot(containerTag: RootTag | number): NodeSet {
309
- const tag = createRootTag(containerTag);
310
- const root = roots.get(tag);
311
- if (!root) {
312
- throw new Error('No root found for containerTag ' + Number(tag));
313
- }
314
- return root;
315
- },
316
-
317
- __getInstanceHandleFromNode(node: Node): InternalInstanceHandle {
318
- return fromNode(node).instanceHandle;
319
- },
320
-
321
- __addCommitHook(commitHook: UIManagerCommitHook): void {
322
- commitHooks.add(commitHook);
323
- },
324
-
325
- __removeCommitHook(commitHook: UIManagerCommitHook): void {
326
- commitHooks.delete(commitHook);
327
- },
328
- };
329
-
330
- global.nativeFabricUIManager = FabricUIManagerMock;
331
-
332
- export function getFabricUIManager(): ?IFabricUIManagerMock {
333
- return FabricUIManagerMock;
334
- }