@office-iss/react-native-win32 0.77.0-preview.3 → 0.78.0-preview.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 (103) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +109 -16
  3. package/CHANGELOG.md +42 -10
  4. package/Libraries/Animated/animations/Animation.js +22 -1
  5. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  6. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  7. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  8. package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
  9. package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
  10. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
  11. package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
  12. package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
  13. package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
  14. package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
  15. package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
  16. package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
  17. package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
  18. package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
  19. package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
  20. package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
  21. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
  22. package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
  23. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  24. package/Libraries/Animated/useAnimatedProps.js +0 -43
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +4 -1
  27. package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
  28. package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
  29. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
  30. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  31. package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
  32. package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
  33. package/Libraries/Components/TextInput/TextInput.js +6 -0
  34. package/Libraries/Components/TextInput/TextInput.win32.js +6 -0
  35. package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
  36. package/Libraries/Components/View/ViewPropTypes.js +0 -9
  37. package/Libraries/Components/View/ViewPropTypes.win32.js +0 -9
  38. package/Libraries/Core/ReactNativeVersion.js +2 -2
  39. package/Libraries/Core/setUpBatchedBridge.js +1 -16
  40. package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
  41. package/Libraries/Image/AssetSourceResolver.js +11 -0
  42. package/Libraries/Inspector/BorderBox.js +26 -14
  43. package/Libraries/Inspector/BoxInspector.js +60 -42
  44. package/Libraries/Inspector/ElementBox.js +55 -48
  45. package/Libraries/Inspector/StyleInspector.js +36 -30
  46. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  47. package/Libraries/Lists/FlatList.d.ts +1 -1
  48. package/Libraries/Modal/Modal.js +2 -0
  49. package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
  50. package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
  51. package/Libraries/NativeComponent/BaseViewConfig.win32.js +0 -2
  52. package/Libraries/Network/RCTNetworking.android.js +24 -16
  53. package/Libraries/Network/RCTNetworking.ios.js +1 -46
  54. package/Libraries/Network/RCTNetworking.win32.js +1 -46
  55. package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
  56. package/Libraries/PersonaCoin/PersonaCoin.js +1 -0
  57. package/Libraries/PersonaCoin/PersonaCoin.js.map +1 -1
  58. package/Libraries/ReactNative/UIManagerProperties.js +3 -1
  59. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
  60. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
  61. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
  62. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
  63. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
  64. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
  65. package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
  66. package/Libraries/StyleSheet/processTransform.js +6 -0
  67. package/Libraries/Text/Text.d.ts +6 -1
  68. package/Libraries/Text/TextProps.js +2 -2
  69. package/Libraries/Text/TextProps.win32.js +2 -2
  70. package/Libraries/Utilities/BackHandler.android.js +5 -4
  71. package/Libraries/Utilities/BackHandler.ios.js +4 -5
  72. package/Libraries/Utilities/BackHandler.win32.js +5 -4
  73. package/index.js +5 -0
  74. package/index.win32.js +5 -0
  75. package/overrides.json +14 -14
  76. package/package.json +20 -21
  77. package/src/private/animated/NativeAnimatedValidation.js +1 -1
  78. package/src/private/featureflags/ReactNativeFeatureFlags.js +32 -26
  79. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
  80. package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
  81. package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
  82. package/src/private/specs/modules/NativeFantom.js +37 -0
  83. package/src/private/utilities/ensureInstance.js +21 -0
  84. package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
  85. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
  86. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  87. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  88. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  89. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  90. package/src/private/webapis/performance/Performance.js +0 -12
  91. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  92. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
  93. package/src-win/Libraries/PersonaCoin/PersonaCoin.tsx +1 -0
  94. package/src-win/Libraries/Text/Text.d.ts +6 -1
  95. package/types/index.d.ts +1 -0
  96. package/Libraries/HeapCapture/HeapCapture.js +0 -29
  97. package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
  98. package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
  99. package/Libraries/Performance/SamplingProfiler.js +0 -39
  100. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  101. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  102. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  103. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -1,39 +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
- * @format
8
- * @flow strict
9
- */
10
-
11
- 'use strict';
12
-
13
- const SamplingProfiler = {
14
- poke: function (token: number): void {
15
- let error = null;
16
- let result = null;
17
- try {
18
- result = global.pokeSamplingProfiler();
19
- if (result === null) {
20
- console.log('The JSC Sampling Profiler has started');
21
- } else {
22
- console.log('The JSC Sampling Profiler has stopped');
23
- }
24
- } catch (e) {
25
- console.log(
26
- 'Error occurred when restarting Sampling Profiler: ' + e.toString(),
27
- );
28
- error = e.toString();
29
- }
30
-
31
- const NativeJSCSamplingProfiler =
32
- require('./NativeJSCSamplingProfiler').default;
33
- if (NativeJSCSamplingProfiler) {
34
- NativeJSCSamplingProfiler.operationComplete(token, result, error);
35
- }
36
- },
37
- };
38
-
39
- module.exports = SamplingProfiler;
@@ -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
- }