@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.
- package/.flowconfig +1 -1
- package/CHANGELOG.json +109 -16
- package/CHANGELOG.md +42 -10
- package/Libraries/Animated/animations/Animation.js +22 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
- package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +0 -43
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +4 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.win32.js +6 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +0 -9
- package/Libraries/Components/View/ViewPropTypes.win32.js +0 -9
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- package/Libraries/Image/AssetSourceResolver.js +11 -0
- package/Libraries/Inspector/BorderBox.js +26 -14
- package/Libraries/Inspector/BoxInspector.js +60 -42
- package/Libraries/Inspector/ElementBox.js +55 -48
- package/Libraries/Inspector/StyleInspector.js +36 -30
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Modal/Modal.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +0 -2
- package/Libraries/Network/RCTNetworking.android.js +24 -16
- package/Libraries/Network/RCTNetworking.ios.js +1 -46
- package/Libraries/Network/RCTNetworking.win32.js +1 -46
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
- package/Libraries/PersonaCoin/PersonaCoin.js +1 -0
- package/Libraries/PersonaCoin/PersonaCoin.js.map +1 -1
- package/Libraries/ReactNative/UIManagerProperties.js +3 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
- package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
- package/Libraries/StyleSheet/processTransform.js +6 -0
- package/Libraries/Text/Text.d.ts +6 -1
- package/Libraries/Text/TextProps.js +2 -2
- package/Libraries/Text/TextProps.win32.js +2 -2
- package/Libraries/Utilities/BackHandler.android.js +5 -4
- package/Libraries/Utilities/BackHandler.ios.js +4 -5
- package/Libraries/Utilities/BackHandler.win32.js +5 -4
- package/index.js +5 -0
- package/index.win32.js +5 -0
- package/overrides.json +14 -14
- package/package.json +20 -21
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +32 -26
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
- package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
- package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
- package/src/private/specs/modules/NativeFantom.js +37 -0
- package/src/private/utilities/ensureInstance.js +21 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/Performance.js +0 -12
- package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/src-win/Libraries/PersonaCoin/PersonaCoin.tsx +1 -0
- package/src-win/Libraries/Text/Text.d.ts +6 -1
- package/types/index.d.ts +1 -0
- package/Libraries/HeapCapture/HeapCapture.js +0 -29
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
- package/Libraries/Performance/SamplingProfiler.js +0 -39
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
- package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
|
@@ -1,327 +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
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This is a mock of `NativeMutationObserver` implementing the same logic as the
|
|
13
|
-
* native module and integrating with the existing mock for `FabricUIManager`.
|
|
14
|
-
* This allows us to test all the JavaScript code for IntersectionObserver in
|
|
15
|
-
* JavaScript as an integration test using only public APIs.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import type {NodeSet} from '../../../../../../Libraries/ReactNative/FabricUIManager';
|
|
19
|
-
import type {RootTag} from '../../../../../../Libraries/ReactNative/RootTag';
|
|
20
|
-
import type {
|
|
21
|
-
InternalInstanceHandle,
|
|
22
|
-
Node,
|
|
23
|
-
} from '../../../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
24
|
-
import type {
|
|
25
|
-
MutationObserverId,
|
|
26
|
-
NativeMutationObserverObserveOptions,
|
|
27
|
-
NativeMutationRecord,
|
|
28
|
-
Spec,
|
|
29
|
-
} from '../NativeMutationObserver';
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
type NodeMock,
|
|
33
|
-
type UIManagerCommitHook,
|
|
34
|
-
fromNode,
|
|
35
|
-
getFabricUIManager,
|
|
36
|
-
getNodeInChildSet,
|
|
37
|
-
} from '../../../../../../Libraries/ReactNative/__mocks__/FabricUIManager';
|
|
38
|
-
import ReadOnlyNode from '../../../dom/nodes/ReadOnlyNode';
|
|
39
|
-
import invariant from 'invariant';
|
|
40
|
-
import nullthrows from 'nullthrows';
|
|
41
|
-
|
|
42
|
-
let pendingRecords: Array<NativeMutationRecord> = [];
|
|
43
|
-
let callback: ?() => void;
|
|
44
|
-
let getPublicInstance: ?(instanceHandle: InternalInstanceHandle) => mixed;
|
|
45
|
-
let observersByRootTag: Map<
|
|
46
|
-
RootTag,
|
|
47
|
-
Map<MutationObserverId, {deep: Set<Node>, shallow: Set<Node>}>,
|
|
48
|
-
> = new Map();
|
|
49
|
-
|
|
50
|
-
const FabricUIManagerMock = nullthrows(getFabricUIManager());
|
|
51
|
-
|
|
52
|
-
function getMockDataFromShadowNode(node: mixed): NodeMock {
|
|
53
|
-
// $FlowExpectedError[incompatible-call]
|
|
54
|
-
return fromNode(node);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function castToNode(node: mixed): Node {
|
|
58
|
-
// $FlowExpectedError[incompatible-return]
|
|
59
|
-
return node;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const NativeMutationMock = {
|
|
63
|
-
observe: (options: NativeMutationObserverObserveOptions): void => {
|
|
64
|
-
const targetShadowNode = castToNode(options.targetShadowNode);
|
|
65
|
-
const rootTag = getMockDataFromShadowNode(options.targetShadowNode).rootTag;
|
|
66
|
-
|
|
67
|
-
let observers = observersByRootTag.get(rootTag);
|
|
68
|
-
if (observers == null) {
|
|
69
|
-
observers = new Map();
|
|
70
|
-
observersByRootTag.set(rootTag, observers);
|
|
71
|
-
}
|
|
72
|
-
let observations = observers.get(options.mutationObserverId);
|
|
73
|
-
if (observations == null) {
|
|
74
|
-
observations = {deep: new Set(), shallow: new Set()};
|
|
75
|
-
observers.set(options.mutationObserverId, observations);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const isTargetBeingObserved =
|
|
79
|
-
observations.deep.has(targetShadowNode) ||
|
|
80
|
-
observations.shallow.has(targetShadowNode);
|
|
81
|
-
invariant(!isTargetBeingObserved, 'unexpected duplicate call to observe');
|
|
82
|
-
|
|
83
|
-
if (options.subtree) {
|
|
84
|
-
observations.deep.add(targetShadowNode);
|
|
85
|
-
} else {
|
|
86
|
-
observations.shallow.add(targetShadowNode);
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
unobserve: (mutationObserverId: number, target: mixed): void => {
|
|
90
|
-
const targetShadowNode = castToNode(target);
|
|
91
|
-
|
|
92
|
-
const observers = observersByRootTag.get(
|
|
93
|
-
getMockDataFromShadowNode(targetShadowNode).rootTag,
|
|
94
|
-
);
|
|
95
|
-
const observations = observers?.get(mutationObserverId);
|
|
96
|
-
invariant(observations != null, 'unexpected call to unobserve');
|
|
97
|
-
|
|
98
|
-
const isTargetBeingObserved =
|
|
99
|
-
observations.deep.has(targetShadowNode) ||
|
|
100
|
-
observations.shallow.has(targetShadowNode);
|
|
101
|
-
invariant(isTargetBeingObserved, 'unexpected call to unobserve');
|
|
102
|
-
|
|
103
|
-
observations.deep.delete(targetShadowNode);
|
|
104
|
-
observations.shallow.delete(targetShadowNode);
|
|
105
|
-
},
|
|
106
|
-
connect: (
|
|
107
|
-
notifyMutationObserversCallback: () => void,
|
|
108
|
-
getPublicInstanceFromInstanceHandle: (
|
|
109
|
-
instanceHandle: InternalInstanceHandle,
|
|
110
|
-
) => mixed,
|
|
111
|
-
): void => {
|
|
112
|
-
invariant(callback == null, 'unexpected call to connect');
|
|
113
|
-
callback = notifyMutationObserversCallback;
|
|
114
|
-
getPublicInstance = getPublicInstanceFromInstanceHandle;
|
|
115
|
-
FabricUIManagerMock.__addCommitHook(NativeMutationObserverCommitHook);
|
|
116
|
-
},
|
|
117
|
-
disconnect: (): void => {
|
|
118
|
-
invariant(callback != null, 'unexpected call to disconnect');
|
|
119
|
-
callback = null;
|
|
120
|
-
FabricUIManagerMock.__removeCommitHook(NativeMutationObserverCommitHook);
|
|
121
|
-
},
|
|
122
|
-
takeRecords: (): $ReadOnlyArray<NativeMutationRecord> => {
|
|
123
|
-
const currentRecords = pendingRecords;
|
|
124
|
-
pendingRecords = [];
|
|
125
|
-
return currentRecords;
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
(NativeMutationMock: Spec);
|
|
130
|
-
|
|
131
|
-
export default NativeMutationMock;
|
|
132
|
-
|
|
133
|
-
const NativeMutationObserverCommitHook: UIManagerCommitHook = {
|
|
134
|
-
shadowTreeWillCommit: (rootTag, oldChildSet, newChildSet) => {
|
|
135
|
-
runMutationObservations(rootTag, oldChildSet, newChildSet);
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
function runMutationObservations(
|
|
140
|
-
rootTag: RootTag,
|
|
141
|
-
oldChildSet: ?NodeSet,
|
|
142
|
-
newChildSet: NodeSet,
|
|
143
|
-
): void {
|
|
144
|
-
const observers = observersByRootTag.get(rootTag);
|
|
145
|
-
if (!observers) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const newRecords: Array<NativeMutationRecord> = [];
|
|
150
|
-
|
|
151
|
-
for (const [mutationObserverId, observations] of observers) {
|
|
152
|
-
const processedNodes: Set<Node> = new Set();
|
|
153
|
-
for (const targetShadowNode of observations.deep) {
|
|
154
|
-
runMutationObservation({
|
|
155
|
-
mutationObserverId,
|
|
156
|
-
targetShadowNode,
|
|
157
|
-
subtree: true,
|
|
158
|
-
oldChildSet,
|
|
159
|
-
newChildSet,
|
|
160
|
-
newRecords,
|
|
161
|
-
processedNodes,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
for (const targetShadowNode of observations.shallow) {
|
|
165
|
-
runMutationObservation({
|
|
166
|
-
mutationObserverId,
|
|
167
|
-
targetShadowNode,
|
|
168
|
-
subtree: false,
|
|
169
|
-
oldChildSet,
|
|
170
|
-
newChildSet,
|
|
171
|
-
newRecords,
|
|
172
|
-
processedNodes,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
for (const record of newRecords) {
|
|
178
|
-
pendingRecords.push(record);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
notifyObserversIfNecessary();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function findNodeOfSameFamily(list: NodeSet, node: Node): ?Node {
|
|
185
|
-
for (const current of list) {
|
|
186
|
-
if (fromNode(current).reactTag === fromNode(node).reactTag) {
|
|
187
|
-
return current;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function recordMutations({
|
|
194
|
-
mutationObserverId,
|
|
195
|
-
targetShadowNode,
|
|
196
|
-
subtree,
|
|
197
|
-
oldNode,
|
|
198
|
-
newNode,
|
|
199
|
-
newRecords,
|
|
200
|
-
processedNodes,
|
|
201
|
-
}: {
|
|
202
|
-
mutationObserverId: MutationObserverId,
|
|
203
|
-
targetShadowNode: Node,
|
|
204
|
-
subtree: boolean,
|
|
205
|
-
oldNode: Node,
|
|
206
|
-
newNode: Node,
|
|
207
|
-
newRecords: Array<NativeMutationRecord>,
|
|
208
|
-
processedNodes: Set<Node>,
|
|
209
|
-
}): void {
|
|
210
|
-
// If the nodes are referentially equal, their children are also the same.
|
|
211
|
-
if (oldNode === newNode || processedNodes.has(newNode)) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
processedNodes.add(newNode);
|
|
216
|
-
|
|
217
|
-
const oldChildren = fromNode(oldNode).children;
|
|
218
|
-
const newChildren = fromNode(newNode).children;
|
|
219
|
-
|
|
220
|
-
const addedNodes = [];
|
|
221
|
-
const removedNodes = [];
|
|
222
|
-
|
|
223
|
-
// Check for removed nodes (and equal nodes for further inspection later)
|
|
224
|
-
for (const oldChild of oldChildren) {
|
|
225
|
-
const newChild = findNodeOfSameFamily(newChildren, oldChild);
|
|
226
|
-
if (newChild == null) {
|
|
227
|
-
removedNodes.push(oldChild);
|
|
228
|
-
} else if (subtree) {
|
|
229
|
-
recordMutations({
|
|
230
|
-
mutationObserverId,
|
|
231
|
-
targetShadowNode,
|
|
232
|
-
subtree,
|
|
233
|
-
oldNode: oldChild,
|
|
234
|
-
newNode: newChild,
|
|
235
|
-
newRecords,
|
|
236
|
-
processedNodes,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Check for added nodes
|
|
242
|
-
for (const newChild of newChildren) {
|
|
243
|
-
const oldChild = findNodeOfSameFamily(oldChildren, newChild);
|
|
244
|
-
if (oldChild == null) {
|
|
245
|
-
addedNodes.push(newChild);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (addedNodes.length > 0 || removedNodes.length > 0) {
|
|
250
|
-
newRecords.push({
|
|
251
|
-
mutationObserverId: mutationObserverId,
|
|
252
|
-
target: nullthrows(getPublicInstance)(
|
|
253
|
-
getMockDataFromShadowNode(targetShadowNode).instanceHandle,
|
|
254
|
-
),
|
|
255
|
-
addedNodes: addedNodes.map(node => {
|
|
256
|
-
const readOnlyNode = nullthrows(getPublicInstance)(
|
|
257
|
-
fromNode(node).instanceHandle,
|
|
258
|
-
);
|
|
259
|
-
invariant(
|
|
260
|
-
readOnlyNode instanceof ReadOnlyNode,
|
|
261
|
-
'expected instance of ReadOnlyNode',
|
|
262
|
-
);
|
|
263
|
-
return readOnlyNode;
|
|
264
|
-
}),
|
|
265
|
-
removedNodes: removedNodes.map(node => {
|
|
266
|
-
const readOnlyNode = nullthrows(getPublicInstance)(
|
|
267
|
-
fromNode(node).instanceHandle,
|
|
268
|
-
);
|
|
269
|
-
invariant(
|
|
270
|
-
readOnlyNode instanceof ReadOnlyNode,
|
|
271
|
-
'expected instance of ReadOnlyNode',
|
|
272
|
-
);
|
|
273
|
-
return readOnlyNode;
|
|
274
|
-
}),
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function runMutationObservation({
|
|
280
|
-
mutationObserverId,
|
|
281
|
-
targetShadowNode,
|
|
282
|
-
subtree,
|
|
283
|
-
oldChildSet,
|
|
284
|
-
newChildSet,
|
|
285
|
-
newRecords,
|
|
286
|
-
processedNodes,
|
|
287
|
-
}: {
|
|
288
|
-
mutationObserverId: MutationObserverId,
|
|
289
|
-
targetShadowNode: Node,
|
|
290
|
-
subtree: boolean,
|
|
291
|
-
oldChildSet: ?NodeSet,
|
|
292
|
-
newChildSet: NodeSet,
|
|
293
|
-
newRecords: Array<NativeMutationRecord>,
|
|
294
|
-
processedNodes: Set<Node>,
|
|
295
|
-
}): void {
|
|
296
|
-
if (!oldChildSet) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const oldTargetShadowNode = getNodeInChildSet(targetShadowNode, oldChildSet);
|
|
301
|
-
if (oldTargetShadowNode == null) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const newTargetShadowNode = getNodeInChildSet(targetShadowNode, newChildSet);
|
|
306
|
-
if (newTargetShadowNode == null) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
recordMutations({
|
|
311
|
-
mutationObserverId,
|
|
312
|
-
targetShadowNode,
|
|
313
|
-
subtree,
|
|
314
|
-
oldNode: oldTargetShadowNode,
|
|
315
|
-
newNode: newTargetShadowNode,
|
|
316
|
-
newRecords,
|
|
317
|
-
processedNodes,
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
function notifyObserversIfNecessary(): void {
|
|
322
|
-
if (pendingRecords.length > 0) {
|
|
323
|
-
// We schedule these using regular tasks in native because microtasks are
|
|
324
|
-
// still not properly supported.
|
|
325
|
-
setTimeout(() => callback?.(), 0);
|
|
326
|
-
}
|
|
327
|
-
}
|