@office-iss/react-native-win32 0.0.0-canary.259 → 0.0.0-canary.260
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 +16 -1
- package/CHANGELOG.md +12 -4
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/animations/Animation.js +10 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
- package/Libraries/Animated/createAnimatedComponent.js +1 -1
- package/Libraries/Animated/useAnimatedProps.js +71 -4
- package/Libraries/Blob/FileReader.js +1 -1
- package/Libraries/Blob/URL.js +2 -62
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -0
- package/Libraries/Components/ScrollView/ScrollView.js +5 -5
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +3 -3
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +3 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +19 -10
- package/Libraries/Components/TextInput/TextInput.win32.js +19 -10
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +11 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewNativeComponent.js +6 -0
- package/Libraries/Components/View/ViewPropTypes.js +14 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
- package/Libraries/Core/InitializeCore.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- package/Libraries/Image/AssetSourceResolver.js +28 -1
- package/Libraries/Image/Image.android.js +9 -14
- package/Libraries/Image/Image.ios.js +11 -22
- package/Libraries/Image/Image.win32.js +10 -21
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +3 -0
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +1 -1
- package/Libraries/Lists/SectionListModern.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +30 -4
- package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +4 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +4 -0
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
- package/Libraries/ReactNative/RendererImplementation.js +24 -2
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +11 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +14 -2
- package/Libraries/StyleSheet/processBackgroundImage.js +286 -0
- package/Libraries/Text/Text.js +7 -6
- package/Libraries/Text/Text.win32.js +7 -6
- package/Libraries/Text/TextNativeComponent.js +7 -0
- package/Libraries/Text/TextNativeComponent.win32.js +7 -0
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/flow/jest.js +2 -2
- package/index.js +1 -0
- package/index.win32.js +1 -0
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +8 -8
- package/overrides.json +12 -12
- package/package.json +13 -13
- package/src/private/{core/components → components}/HScrollViewNativeComponents.js +8 -8
- package/src/private/{core/components → components}/VScrollViewNativeComponents.js +7 -7
- package/src/private/{core/components → components}/useSyncOnScroll.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +84 -7
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -2
- package/src/private/hooks/DebouncedEffectImplementation.js +148 -0
- package/src/private/hooks/useDebouncedEffect.js +23 -0
- package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +5 -4
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/modules/NativeDebuggerSessionObserver.js +23 -0
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +1 -1
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +5 -8
- package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +1 -1
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +5 -5
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
- package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/Performance.js +22 -9
- package/src/private/webapis/performance/PerformanceEntry.js +35 -17
- package/src/private/webapis/performance/PerformanceObserver.js +29 -43
- package/src/private/webapis/performance/RawPerformanceEntry.js +19 -1
- package/src/private/webapis/performance/UserTiming.js +17 -12
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
- package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/types/experimental.d.ts +10 -2
- package/Libraries/Core/setUpIntersectionObserver.js +0 -16
- package/Libraries/Core/setUpMutationObserver.js +0 -16
- package/Libraries/Core/setUpPerformanceObserver.js +0 -18
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
- package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
- package/src/private/core/setUpDOM.js +0 -18
- package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
- /package/src/private/{core → styles}/composeStyles.js +0 -0
|
@@ -4,13 +4,75 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @flow strict
|
|
8
7
|
* @format
|
|
8
|
+
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
// flowlint unsafe-getters-setters:off
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
DOMHighResTimeStamp,
|
|
15
|
+
PerformanceEntryJSON,
|
|
16
|
+
} from './PerformanceEntry';
|
|
17
|
+
|
|
18
|
+
import {PerformanceEntry} from './PerformanceEntry';
|
|
11
19
|
import {warnNoNativePerformanceObserver} from './PerformanceObserver';
|
|
12
20
|
import NativePerformanceObserver from './specs/NativePerformanceObserver';
|
|
13
21
|
|
|
22
|
+
export type PerformanceEventTimingJSON = {
|
|
23
|
+
...PerformanceEntryJSON,
|
|
24
|
+
processingStart: DOMHighResTimeStamp,
|
|
25
|
+
processingEnd: DOMHighResTimeStamp,
|
|
26
|
+
interactionId: number,
|
|
27
|
+
...
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export class PerformanceEventTiming extends PerformanceEntry {
|
|
31
|
+
#processingStart: DOMHighResTimeStamp;
|
|
32
|
+
#processingEnd: DOMHighResTimeStamp;
|
|
33
|
+
#interactionId: number;
|
|
34
|
+
|
|
35
|
+
constructor(init: {
|
|
36
|
+
name: string,
|
|
37
|
+
startTime?: DOMHighResTimeStamp,
|
|
38
|
+
duration?: DOMHighResTimeStamp,
|
|
39
|
+
processingStart?: DOMHighResTimeStamp,
|
|
40
|
+
processingEnd?: DOMHighResTimeStamp,
|
|
41
|
+
interactionId?: number,
|
|
42
|
+
}) {
|
|
43
|
+
super({
|
|
44
|
+
name: init.name,
|
|
45
|
+
entryType: 'event',
|
|
46
|
+
startTime: init.startTime ?? 0,
|
|
47
|
+
duration: init.duration ?? 0,
|
|
48
|
+
});
|
|
49
|
+
this.#processingStart = init.processingStart ?? 0;
|
|
50
|
+
this.#processingEnd = init.processingEnd ?? 0;
|
|
51
|
+
this.#interactionId = init.interactionId ?? 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get processingStart(): DOMHighResTimeStamp {
|
|
55
|
+
return this.#processingStart;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get processingEnd(): DOMHighResTimeStamp {
|
|
59
|
+
return this.#processingEnd;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get interactionId(): number {
|
|
63
|
+
return this.#interactionId;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
toJSON(): PerformanceEventTimingJSON {
|
|
67
|
+
return {
|
|
68
|
+
...super.toJSON(),
|
|
69
|
+
processingStart: this.#processingStart,
|
|
70
|
+
processingEnd: this.#processingEnd,
|
|
71
|
+
interactionId: this.#interactionId,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
14
76
|
type EventCountsForEachCallbackType =
|
|
15
77
|
| (() => void)
|
|
16
78
|
| ((value: number) => void)
|
|
@@ -41,13 +103,13 @@ function getCachedEventCounts(): Map<string, number> {
|
|
|
41
103
|
});
|
|
42
104
|
return cachedEventCounts ?? new Map();
|
|
43
105
|
}
|
|
106
|
+
|
|
44
107
|
/**
|
|
45
108
|
* Implementation of the EventCounts Web Performance API
|
|
46
109
|
* corresponding to the standard in
|
|
47
110
|
* https://www.w3.org/TR/event-timing/#eventcounts
|
|
48
111
|
*/
|
|
49
|
-
export
|
|
50
|
-
// flowlint unsafe-getters-setters:off
|
|
112
|
+
export class EventCounts {
|
|
51
113
|
get size(): number {
|
|
52
114
|
return getCachedEventCounts().size;
|
|
53
115
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
// flowlint unsafe-getters-setters:off
|
|
12
|
+
|
|
13
|
+
import type {PerformanceEntryJSON} from './PerformanceEntry';
|
|
14
|
+
|
|
15
|
+
import {PerformanceEntry} from './PerformanceEntry';
|
|
16
|
+
|
|
17
|
+
export type PerformanceLongTaskTimingJSON = {
|
|
18
|
+
...PerformanceEntryJSON,
|
|
19
|
+
attribution: $ReadOnlyArray<TaskAttributionTiming>,
|
|
20
|
+
...
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export class TaskAttributionTiming extends PerformanceEntry {}
|
|
24
|
+
|
|
25
|
+
const EMPTY_ATTRIBUTION: $ReadOnlyArray<TaskAttributionTiming> =
|
|
26
|
+
Object.preventExtensions([]);
|
|
27
|
+
|
|
28
|
+
export class PerformanceLongTaskTiming extends PerformanceEntry {
|
|
29
|
+
get attribution(): $ReadOnlyArray<TaskAttributionTiming> {
|
|
30
|
+
return EMPTY_ATTRIBUTION;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
toJSON(): PerformanceLongTaskTimingJSON {
|
|
34
|
+
return {
|
|
35
|
+
...super.toJSON(),
|
|
36
|
+
attribution: this.attribution,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
// flowlint unsafe-getters-setters:off
|
|
12
12
|
|
|
13
|
-
import type {HighResTimeStamp, PerformanceEntryType} from './PerformanceEntry';
|
|
14
|
-
import type {PerformanceEntryList} from './PerformanceObserver';
|
|
15
13
|
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from './
|
|
14
|
+
DOMHighResTimeStamp,
|
|
15
|
+
PerformanceEntryType,
|
|
16
|
+
} from './PerformanceEntry';
|
|
17
|
+
import type {PerformanceEntryList} from './PerformanceObserver';
|
|
18
|
+
import type {DetailType, PerformanceMarkOptions} from './UserTiming';
|
|
19
19
|
|
|
20
20
|
import warnOnce from '../../../../Libraries/Utilities/warnOnce';
|
|
21
|
-
import EventCounts from './
|
|
21
|
+
import {EventCounts} from './EventTiming';
|
|
22
22
|
import MemoryInfo from './MemoryInfo';
|
|
23
23
|
import {ALWAYS_LOGGED_ENTRY_TYPES} from './PerformanceEntry';
|
|
24
24
|
import {warnNoNativePerformanceObserver} from './PerformanceObserver';
|
|
@@ -37,7 +37,7 @@ declare var global: {
|
|
|
37
37
|
+nativePerformanceNow?: ?() => number,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const getCurrentTimeStamp: () =>
|
|
40
|
+
const getCurrentTimeStamp: () => DOMHighResTimeStamp =
|
|
41
41
|
NativePerformance?.now ?? global.nativePerformanceNow ?? (() => Date.now());
|
|
42
42
|
|
|
43
43
|
// We want some of the performance entry types to be always logged,
|
|
@@ -58,6 +58,13 @@ function warnNoNativePerformance() {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
export type PerformanceMeasureOptions = {
|
|
62
|
+
detail?: DetailType,
|
|
63
|
+
start?: DOMHighResTimeStamp,
|
|
64
|
+
duration?: DOMHighResTimeStamp,
|
|
65
|
+
end?: DOMHighResTimeStamp,
|
|
66
|
+
};
|
|
67
|
+
|
|
61
68
|
/**
|
|
62
69
|
* Partial implementation of the Performance interface for RN,
|
|
63
70
|
* corresponding to the standard in
|
|
@@ -195,7 +202,13 @@ export default class Performance {
|
|
|
195
202
|
duration = options.duration ?? duration;
|
|
196
203
|
}
|
|
197
204
|
|
|
198
|
-
const measure = new PerformanceMeasure(measureName,
|
|
205
|
+
const measure = new PerformanceMeasure(measureName, {
|
|
206
|
+
// FIXME(T196011255): this is incorrect, as we're only assigning the
|
|
207
|
+
// start/end if they're specified as a number, but not if they're
|
|
208
|
+
// specified as previous mark names.
|
|
209
|
+
startTime,
|
|
210
|
+
duration,
|
|
211
|
+
});
|
|
199
212
|
|
|
200
213
|
if (NativePerformance?.measure) {
|
|
201
214
|
NativePerformance.measure(
|
|
@@ -229,7 +242,7 @@ export default class Performance {
|
|
|
229
242
|
* Returns a double, measured in milliseconds.
|
|
230
243
|
* https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
|
|
231
244
|
*/
|
|
232
|
-
now():
|
|
245
|
+
now(): DOMHighResTimeStamp {
|
|
233
246
|
return getCurrentTimeStamp();
|
|
234
247
|
}
|
|
235
248
|
|
|
@@ -8,14 +8,16 @@
|
|
|
8
8
|
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// flowlint unsafe-getters-setters:off
|
|
12
|
+
|
|
13
|
+
export type DOMHighResTimeStamp = number;
|
|
12
14
|
export type PerformanceEntryType = 'mark' | 'measure' | 'event' | 'longtask';
|
|
13
15
|
|
|
14
16
|
export type PerformanceEntryJSON = {
|
|
15
17
|
name: string,
|
|
16
18
|
entryType: PerformanceEntryType,
|
|
17
|
-
startTime:
|
|
18
|
-
duration:
|
|
19
|
+
startTime: DOMHighResTimeStamp,
|
|
20
|
+
duration: DOMHighResTimeStamp,
|
|
19
21
|
...
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -25,29 +27,45 @@ export const ALWAYS_LOGGED_ENTRY_TYPES: $ReadOnlyArray<PerformanceEntryType> = [
|
|
|
25
27
|
];
|
|
26
28
|
|
|
27
29
|
export class PerformanceEntry {
|
|
28
|
-
name: string;
|
|
29
|
-
entryType: PerformanceEntryType;
|
|
30
|
-
startTime:
|
|
31
|
-
duration:
|
|
30
|
+
#name: string;
|
|
31
|
+
#entryType: PerformanceEntryType;
|
|
32
|
+
#startTime: DOMHighResTimeStamp;
|
|
33
|
+
#duration: DOMHighResTimeStamp;
|
|
32
34
|
|
|
33
35
|
constructor(init: {
|
|
34
36
|
name: string,
|
|
35
37
|
entryType: PerformanceEntryType,
|
|
36
|
-
startTime:
|
|
37
|
-
duration:
|
|
38
|
+
startTime: DOMHighResTimeStamp,
|
|
39
|
+
duration: DOMHighResTimeStamp,
|
|
38
40
|
}) {
|
|
39
|
-
this
|
|
40
|
-
this
|
|
41
|
-
this
|
|
42
|
-
this
|
|
41
|
+
this.#name = init.name;
|
|
42
|
+
this.#entryType = init.entryType;
|
|
43
|
+
this.#startTime = init.startTime;
|
|
44
|
+
this.#duration = init.duration;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get name(): string {
|
|
48
|
+
return this.#name;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get entryType(): PerformanceEntryType {
|
|
52
|
+
return this.#entryType;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get startTime(): DOMHighResTimeStamp {
|
|
56
|
+
return this.#startTime;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get duration(): DOMHighResTimeStamp {
|
|
60
|
+
return this.#duration;
|
|
43
61
|
}
|
|
44
62
|
|
|
45
63
|
toJSON(): PerformanceEntryJSON {
|
|
46
64
|
return {
|
|
47
|
-
name: this
|
|
48
|
-
entryType: this
|
|
49
|
-
startTime: this
|
|
50
|
-
duration: this
|
|
65
|
+
name: this.#name,
|
|
66
|
+
entryType: this.#entryType,
|
|
67
|
+
startTime: this.#startTime,
|
|
68
|
+
duration: this.#duration,
|
|
51
69
|
};
|
|
52
70
|
}
|
|
53
71
|
}
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
DOMHighResTimeStamp,
|
|
13
|
+
PerformanceEntryType,
|
|
14
|
+
} from './PerformanceEntry';
|
|
12
15
|
|
|
13
16
|
import warnOnce from '../../../../Libraries/Utilities/warnOnce';
|
|
17
|
+
import {PerformanceEventTiming} from './EventTiming';
|
|
14
18
|
import {PerformanceEntry} from './PerformanceEntry';
|
|
15
|
-
import PerformanceEventTiming from './PerformanceEventTiming';
|
|
16
19
|
import {
|
|
17
20
|
performanceEntryTypeToRaw,
|
|
18
21
|
rawToPerformanceEntry,
|
|
@@ -66,13 +69,13 @@ export type PerformanceObserverInit =
|
|
|
66
69
|
}
|
|
67
70
|
| {
|
|
68
71
|
type: PerformanceEntryType,
|
|
69
|
-
durationThreshold?:
|
|
72
|
+
durationThreshold?: DOMHighResTimeStamp,
|
|
70
73
|
};
|
|
71
74
|
|
|
72
75
|
type PerformanceObserverConfig = {|
|
|
73
76
|
callback: PerformanceObserverCallback,
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
entryTypes: $ReadOnlySet<PerformanceEntryType>,
|
|
78
|
+
durationThreshold: ?number,
|
|
76
79
|
|};
|
|
77
80
|
|
|
78
81
|
const observerCountPerEntryType: Map<PerformanceEntryType, number> = new Map();
|
|
@@ -97,8 +100,15 @@ const onPerformanceEntry = () => {
|
|
|
97
100
|
if (!observerConfig.entryTypes.has(entry.entryType)) {
|
|
98
101
|
return false;
|
|
99
102
|
}
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
|
|
104
|
+
if (
|
|
105
|
+
entry.entryType === 'event' &&
|
|
106
|
+
observerConfig.durationThreshold != null
|
|
107
|
+
) {
|
|
108
|
+
return entry.duration >= observerConfig.durationThreshold;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return true;
|
|
102
112
|
});
|
|
103
113
|
if (entriesForObserver.length !== 0) {
|
|
104
114
|
try {
|
|
@@ -122,21 +132,11 @@ export function warnNoNativePerformanceObserver() {
|
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
function applyDurationThresholds() {
|
|
125
|
-
const durationThresholds
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
(accumulator, currentValue) => union(accumulator, currentValue),
|
|
131
|
-
new Map(),
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
for (const [entryType, durationThreshold] of durationThresholds) {
|
|
135
|
-
NativePerformanceObserver?.setDurationThreshold(
|
|
136
|
-
performanceEntryTypeToRaw(entryType),
|
|
137
|
-
durationThreshold ?? 0,
|
|
138
|
-
);
|
|
139
|
-
}
|
|
135
|
+
const durationThresholds = Array.from(registeredObservers.values())
|
|
136
|
+
.map(observerConfig => observerConfig.durationThreshold)
|
|
137
|
+
.filter(Boolean);
|
|
138
|
+
|
|
139
|
+
return Math.min(...durationThresholds);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
function getSupportedPerformanceEntryTypes(): $ReadOnlyArray<PerformanceEntryType> {
|
|
@@ -174,7 +174,7 @@ function getSupportedPerformanceEntryTypes(): $ReadOnlyArray<PerformanceEntryTyp
|
|
|
174
174
|
* });
|
|
175
175
|
* observer.observe({ type: "event" });
|
|
176
176
|
*/
|
|
177
|
-
export
|
|
177
|
+
export class PerformanceObserver {
|
|
178
178
|
#callback: PerformanceObserverCallback;
|
|
179
179
|
#type: 'single' | 'multiple' | void;
|
|
180
180
|
|
|
@@ -194,14 +194,10 @@ export default class PerformanceObserver {
|
|
|
194
194
|
|
|
195
195
|
if (options.entryTypes) {
|
|
196
196
|
this.#type = 'multiple';
|
|
197
|
-
requestedEntryTypes = new
|
|
198
|
-
options.entryTypes.map(t => [t, undefined]),
|
|
199
|
-
);
|
|
197
|
+
requestedEntryTypes = new Set(options.entryTypes);
|
|
200
198
|
} else {
|
|
201
199
|
this.#type = 'single';
|
|
202
|
-
requestedEntryTypes = new
|
|
203
|
-
[options.type, options.durationThreshold],
|
|
204
|
-
]);
|
|
200
|
+
requestedEntryTypes = new Set([options.type]);
|
|
205
201
|
}
|
|
206
202
|
|
|
207
203
|
// The same observer may receive multiple calls to "observe", so we need
|
|
@@ -218,6 +214,8 @@ export default class PerformanceObserver {
|
|
|
218
214
|
|
|
219
215
|
registeredObservers.set(this, {
|
|
220
216
|
callback: this.#callback,
|
|
217
|
+
durationThreshold:
|
|
218
|
+
options.type === 'event' ? options.durationThreshold : undefined,
|
|
221
219
|
entryTypes: nextEntryTypes,
|
|
222
220
|
});
|
|
223
221
|
|
|
@@ -322,20 +320,8 @@ export default class PerformanceObserver {
|
|
|
322
320
|
getSupportedPerformanceEntryTypes();
|
|
323
321
|
}
|
|
324
322
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
a: $ReadOnlyMap<T, ?number>,
|
|
328
|
-
b: $ReadOnlyMap<T, ?number>,
|
|
329
|
-
): Map<T, ?number> {
|
|
330
|
-
const res = new Map<T, ?number>();
|
|
331
|
-
for (const [k, v] of a) {
|
|
332
|
-
if (!b.has(k)) {
|
|
333
|
-
res.set(k, v);
|
|
334
|
-
} else {
|
|
335
|
-
res.set(k, Math.min(v ?? 0, b.get(k) ?? 0));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return res;
|
|
323
|
+
function union<T>(a: $ReadOnlySet<T>, b: $ReadOnlySet<T>): Set<T> {
|
|
324
|
+
return new Set([...a, ...b]);
|
|
339
325
|
}
|
|
340
326
|
|
|
341
327
|
function difference<T>(a: $ReadOnlySet<T>, b: $ReadOnlySet<T>): Set<T> {
|
|
@@ -14,8 +14,10 @@ import type {
|
|
|
14
14
|
RawPerformanceEntryType,
|
|
15
15
|
} from './specs/NativePerformanceObserver';
|
|
16
16
|
|
|
17
|
+
import {PerformanceEventTiming} from './EventTiming';
|
|
18
|
+
import {PerformanceLongTaskTiming} from './LongTasks';
|
|
17
19
|
import {PerformanceEntry} from './PerformanceEntry';
|
|
18
|
-
import
|
|
20
|
+
import {PerformanceMark, PerformanceMeasure} from './UserTiming';
|
|
19
21
|
|
|
20
22
|
export const RawPerformanceEntryTypeValues = {
|
|
21
23
|
MARK: 1,
|
|
@@ -36,6 +38,22 @@ export function rawToPerformanceEntry(
|
|
|
36
38
|
processingEnd: entry.processingEnd,
|
|
37
39
|
interactionId: entry.interactionId,
|
|
38
40
|
});
|
|
41
|
+
} else if (entry.entryType === RawPerformanceEntryTypeValues.LONGTASK) {
|
|
42
|
+
return new PerformanceLongTaskTiming({
|
|
43
|
+
name: entry.name,
|
|
44
|
+
entryType: rawToPerformanceEntryType(entry.entryType),
|
|
45
|
+
startTime: entry.startTime,
|
|
46
|
+
duration: entry.duration,
|
|
47
|
+
});
|
|
48
|
+
} else if (entry.entryType === RawPerformanceEntryTypeValues.MARK) {
|
|
49
|
+
return new PerformanceMark(entry.name, {
|
|
50
|
+
startTime: entry.startTime,
|
|
51
|
+
});
|
|
52
|
+
} else if (entry.entryType === RawPerformanceEntryTypeValues.MEASURE) {
|
|
53
|
+
return new PerformanceMeasure(entry.name, {
|
|
54
|
+
startTime: entry.startTime,
|
|
55
|
+
duration: entry.duration,
|
|
56
|
+
});
|
|
39
57
|
} else {
|
|
40
58
|
return new PerformanceEntry({
|
|
41
59
|
name: entry.name,
|
|
@@ -8,24 +8,25 @@
|
|
|
8
8
|
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// flowlint unsafe-getters-setters:off
|
|
12
|
+
|
|
13
|
+
import type {DOMHighResTimeStamp} from './PerformanceEntry';
|
|
12
14
|
|
|
13
15
|
import {PerformanceEntry} from './PerformanceEntry';
|
|
14
16
|
|
|
15
|
-
type DetailType = mixed;
|
|
17
|
+
export type DetailType = mixed;
|
|
16
18
|
|
|
17
19
|
export type PerformanceMarkOptions = {
|
|
18
20
|
detail?: DetailType,
|
|
19
|
-
startTime?:
|
|
21
|
+
startTime?: DOMHighResTimeStamp,
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
export type TimeStampOrName =
|
|
24
|
+
export type TimeStampOrName = DOMHighResTimeStamp | string;
|
|
23
25
|
|
|
24
|
-
export type
|
|
26
|
+
export type PerformanceMeasureInit = {
|
|
25
27
|
detail?: DetailType,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
duration?: HighResTimeStamp,
|
|
28
|
+
startTime?: DOMHighResTimeStamp,
|
|
29
|
+
duration?: DOMHighResTimeStamp,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export class PerformanceMark extends PerformanceEntry {
|
|
@@ -46,18 +47,22 @@ export class PerformanceMark extends PerformanceEntry {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export class PerformanceMeasure extends PerformanceEntry {
|
|
49
|
-
detail: DetailType;
|
|
50
|
+
#detail: DetailType;
|
|
50
51
|
|
|
51
|
-
constructor(measureName: string, measureOptions?:
|
|
52
|
+
constructor(measureName: string, measureOptions?: PerformanceMeasureInit) {
|
|
52
53
|
super({
|
|
53
54
|
name: measureName,
|
|
54
55
|
entryType: 'measure',
|
|
55
|
-
startTime: 0,
|
|
56
|
+
startTime: measureOptions?.startTime ?? 0,
|
|
56
57
|
duration: measureOptions?.duration ?? 0,
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
if (measureOptions) {
|
|
60
|
-
this
|
|
61
|
+
this.#detail = measureOptions.detail;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
64
|
+
|
|
65
|
+
get detail(): DetailType {
|
|
66
|
+
return this.#detail;
|
|
67
|
+
}
|
|
63
68
|
}
|
|
@@ -366,6 +366,21 @@ export interface AccessibilityPropsIOS {
|
|
|
366
366
|
* @platform ios
|
|
367
367
|
*/
|
|
368
368
|
accessibilityLanguage?: string | undefined;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* A Boolean value that indicates whether or not to show the item in the large content viewer.
|
|
372
|
+
* Available on iOS 13.0+
|
|
373
|
+
* https://reactnative.dev/docs/accessibility#accessibilityshowslargecontentviewer
|
|
374
|
+
* @platform ios
|
|
375
|
+
*/
|
|
376
|
+
accessibilityShowsLargeContentViewer?: boolean | undefined;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* When `accessibilityShowsLargeContentViewer` is set, this string will be used as title for the large content viewer.
|
|
380
|
+
* https://reactnative.dev/docs/accessibility#accessibilitylargecontenttitle
|
|
381
|
+
* @platform ios
|
|
382
|
+
*/
|
|
383
|
+
accessibilityLargeContentTitle?: string | undefined;
|
|
369
384
|
}
|
|
370
385
|
|
|
371
386
|
// [Win32]
|
package/types/experimental.d.ts
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import {
|
|
36
|
+
GradientValue,
|
|
36
37
|
BlendMode,
|
|
37
38
|
BoxShadowPrimitive,
|
|
38
39
|
DimensionValue,
|
|
@@ -149,8 +150,15 @@ declare module '.' {
|
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
export interface ViewStyle {
|
|
152
|
-
experimental_boxShadow?:
|
|
153
|
-
|
|
153
|
+
experimental_boxShadow?:
|
|
154
|
+
| ReadonlyArray<BoxShadowPrimitive>
|
|
155
|
+
| string
|
|
156
|
+
| undefined;
|
|
157
|
+
experimental_filter?: ReadonlyArray<FilterFunction> | string | undefined;
|
|
154
158
|
experimental_mixBlendMode?: BlendMode | undefined;
|
|
159
|
+
experimental_backgroundImage?:
|
|
160
|
+
| ReadonlyArray<GradientValue>
|
|
161
|
+
| string
|
|
162
|
+
| undefined;
|
|
155
163
|
}
|
|
156
164
|
}
|
|
@@ -1,16 +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
|
-
import {polyfillGlobal} from '../Utilities/PolyfillFunctions';
|
|
12
|
-
|
|
13
|
-
polyfillGlobal(
|
|
14
|
-
'IntersectionObserver',
|
|
15
|
-
() => require('../IntersectionObserver/IntersectionObserver').default,
|
|
16
|
-
);
|
|
@@ -1,16 +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
|
-
import {polyfillGlobal} from '../Utilities/PolyfillFunctions';
|
|
12
|
-
|
|
13
|
-
polyfillGlobal(
|
|
14
|
-
'MutationObserver',
|
|
15
|
-
() => require('../MutationObserver/MutationObserver').default,
|
|
16
|
-
);
|
|
@@ -1,18 +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
|
-
import {polyfillGlobal} from '../Utilities/PolyfillFunctions';
|
|
12
|
-
|
|
13
|
-
polyfillGlobal(
|
|
14
|
-
'PerformanceObserver',
|
|
15
|
-
() =>
|
|
16
|
-
require('../../src/private/webapis/performance/PerformanceObserver')
|
|
17
|
-
.default,
|
|
18
|
-
);
|
|
@@ -1,13 +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
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export * from '../../src/private/specs/modules/NativeIntersectionObserver';
|
|
12
|
-
import NativeIntersectionObserver from '../../src/private/specs/modules/NativeIntersectionObserver';
|
|
13
|
-
export default NativeIntersectionObserver;
|
|
@@ -1,13 +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
|
-
export * from '../../src/private/specs/modules/NativeMutationObserver';
|
|
12
|
-
import NativeMutationObserver from '../../src/private/specs/modules/NativeMutationObserver';
|
|
13
|
-
export default NativeMutationObserver;
|
|
@@ -1,18 +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
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import DOMRect from '../webapis/dom/geometry/DOMRect';
|
|
12
|
-
import DOMRectReadOnly from '../webapis/dom/geometry/DOMRectReadOnly';
|
|
13
|
-
|
|
14
|
-
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
|
15
|
-
global.DOMRect = DOMRect;
|
|
16
|
-
|
|
17
|
-
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
|
18
|
-
global.DOMRectReadOnly = DOMRectReadOnly;
|