@office-iss/react-native-win32 0.0.0-canary.265 → 0.0.0-canary.267

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 (54) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +15011 -14981
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Animated/animations/Animation.js +4 -1
  5. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  6. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +17 -0
  7. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +1 -0
  8. package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
  9. package/Libraries/Components/Touchable/Position.js +7 -2
  10. package/Libraries/Components/Touchable/Touchable.js +4 -0
  11. package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
  12. package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -1
  13. package/Libraries/Core/ReactNativeVersion.js +1 -1
  14. package/Libraries/Core/setUpReactDevTools.js +33 -7
  15. package/Libraries/Inspector/NetworkOverlay.js +4 -0
  16. package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -13
  17. package/Libraries/Interaction/TouchHistoryMath.js +22 -19
  18. package/Libraries/LogBox/Data/LogBoxData.js +2 -2
  19. package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -1
  20. package/Libraries/NativeComponent/BaseViewConfig.ios.js +1 -1
  21. package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -1
  22. package/Libraries/Network/XHRInterceptor.js +63 -14
  23. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  24. package/Libraries/StyleSheet/StyleSheetTypes.js +1 -1
  25. package/Libraries/WebSocket/WebSocketEvent.js +4 -1
  26. package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
  27. package/index.js +4 -0
  28. package/index.win32.js +4 -0
  29. package/overrides.json +12 -12
  30. package/package.json +14 -14
  31. package/src/private/devmenu/DevMenu.d.ts +20 -0
  32. package/src/private/devmenu/DevMenu.js +31 -0
  33. package/src/private/featureflags/ReactNativeFeatureFlags.js +22 -11
  34. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -3
  35. package/src/private/reactdevtools/ReactDevToolsSettingsManager.android.js +20 -0
  36. package/src/private/reactdevtools/ReactDevToolsSettingsManager.ios.js +30 -0
  37. package/src/private/reactdevtools/ReactDevToolsSettingsManager.win32.js +20 -0
  38. package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
  39. package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
  40. package/src/private/webapis/performance/EventTiming.js +1 -1
  41. package/src/private/webapis/performance/Performance.js +3 -21
  42. package/src/private/webapis/performance/PerformanceObserver.js +68 -155
  43. package/src/private/webapis/performance/Utilities.js +25 -0
  44. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +24 -16
  45. package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +11 -9
  46. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +85 -58
  47. package/types/experimental.d.ts +1 -1
  48. package/types/index.d.ts +1 -1
  49. package/types/public/ReactNativeTypes.d.ts +0 -4
  50. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
  51. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
  52. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
  53. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
  54. package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
@@ -14,6 +14,10 @@ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/Turbo
14
14
 
15
15
  export type RawPerformanceEntryType = number;
16
16
 
17
+ export type OpaqueNativeObserverHandle = mixed;
18
+
19
+ export type NativeBatchedObserverCallback = () => void;
20
+
17
21
  export type RawPerformanceEntry = {|
18
22
  name: string,
19
23
  entryType: RawPerformanceEntryType,
@@ -25,26 +29,30 @@ export type RawPerformanceEntry = {|
25
29
  interactionId?: number,
26
30
  |};
27
31
 
28
- export type GetPendingEntriesResult = {|
29
- entries: $ReadOnlyArray<RawPerformanceEntry>,
30
- droppedEntriesCount: number,
31
- |};
32
+ export type PerformanceObserverInit = {
33
+ entryTypes?: $ReadOnlyArray<number>,
34
+ type?: number,
35
+ buffered?: boolean,
36
+ durationThreshold?: number,
37
+ };
32
38
 
33
39
  export interface Spec extends TurboModule {
34
- +startReporting: (entryType: RawPerformanceEntryType) => void;
35
- +stopReporting: (entryType: RawPerformanceEntryType) => void;
36
- +setIsBuffered: (
37
- entryTypes: $ReadOnlyArray<RawPerformanceEntryType>,
38
- isBuffered: boolean,
39
- ) => void;
40
- +popPendingEntries: () => GetPendingEntriesResult;
41
- +setOnPerformanceEntryCallback: (callback?: () => void) => void;
42
- +logRawEntry: (entry: RawPerformanceEntry) => void;
43
40
  +getEventCounts: () => $ReadOnlyArray<[string, number]>;
44
- +setDurationThreshold: (
45
- entryType: RawPerformanceEntryType,
46
- durationThreshold: number,
41
+ +createObserver?: (
42
+ callback: NativeBatchedObserverCallback,
43
+ ) => OpaqueNativeObserverHandle;
44
+ +getDroppedEntriesCount?: (observer: OpaqueNativeObserverHandle) => number;
45
+
46
+ +observe?: (
47
+ observer: OpaqueNativeObserverHandle,
48
+ options: PerformanceObserverInit,
47
49
  ) => void;
50
+ +disconnect?: (observer: OpaqueNativeObserverHandle) => void;
51
+ +takeRecords?: (
52
+ observer: OpaqueNativeObserverHandle,
53
+ sort: boolean,
54
+ ) => $ReadOnlyArray<RawPerformanceEntry>;
55
+
48
56
  +clearEntries: (
49
57
  entryType?: RawPerformanceEntryType,
50
58
  entryName?: string,
@@ -11,23 +11,24 @@
11
11
  import type {
12
12
  NativeMemoryInfo,
13
13
  ReactNativeStartupTiming,
14
- Spec as NativePerformance,
15
14
  } from '../NativePerformance';
16
15
 
17
16
  import {RawPerformanceEntryTypeValues} from '../../RawPerformanceEntry';
18
- import NativePerformanceObserver from '../NativePerformanceObserver';
17
+ import NativePerformance from '../NativePerformance';
18
+ import {logMockEntry} from './NativePerformanceObserver';
19
19
 
20
20
  const marks: Map<string, number> = new Map();
21
21
 
22
- const NativePerformanceMock: NativePerformance = {
22
+ const NativePerformanceMock: typeof NativePerformance = {
23
23
  mark: (name: string, startTime: number): void => {
24
- NativePerformanceObserver?.logRawEntry({
25
- name,
24
+ NativePerformance?.mark(name, startTime);
25
+ marks.set(name, startTime);
26
+ logMockEntry({
26
27
  entryType: RawPerformanceEntryTypeValues.MARK,
28
+ name,
27
29
  startTime,
28
30
  duration: 0,
29
31
  });
30
- marks.set(name, startTime);
31
32
  },
32
33
 
33
34
  measure: (
@@ -40,11 +41,12 @@ const NativePerformanceMock: NativePerformance = {
40
41
  ): void => {
41
42
  const start = startMark != null ? marks.get(startMark) ?? 0 : startTime;
42
43
  const end = endMark != null ? marks.get(endMark) ?? 0 : endTime;
43
- NativePerformanceObserver?.logRawEntry({
44
- name,
44
+ NativePerformance?.measure(name, start, end);
45
+ logMockEntry({
45
46
  entryType: RawPerformanceEntryTypeValues.MEASURE,
47
+ name,
46
48
  startTime: start,
47
- duration: duration ?? (end ? end - start : 0),
49
+ duration: duration ?? end - start,
48
50
  });
49
51
  },
50
52
 
@@ -9,90 +9,117 @@
9
9
  */
10
10
 
11
11
  import type {
12
- GetPendingEntriesResult,
12
+ NativeBatchedObserverCallback,
13
13
  RawPerformanceEntry,
14
14
  RawPerformanceEntryType,
15
+ OpaqueNativeObserverHandle,
16
+ PerformanceObserverInit,
15
17
  Spec as NativePerformanceObserver,
16
18
  } from '../NativePerformanceObserver';
17
19
 
18
20
  import {RawPerformanceEntryTypeValues} from '../../RawPerformanceEntry';
19
21
 
20
- const reportingType: Set<RawPerformanceEntryType> = new Set();
21
- const isAlwaysLogged: Set<RawPerformanceEntryType> = new Set();
22
+ jest.mock(
23
+ '../NativePerformance',
24
+ () => require('../__mocks__/NativePerformance').default,
25
+ );
26
+
27
+ jest.mock(
28
+ '../NativePerformanceObserver',
29
+ () => require('../__mocks__/NativePerformanceObserver').default,
30
+ );
31
+
22
32
  const eventCounts: Map<string, number> = new Map();
23
- const durationThresholds: Map<RawPerformanceEntryType, number> = new Map();
33
+ let observers: MockObserver[] = [];
24
34
  let entries: Array<RawPerformanceEntry> = [];
25
- let onPerformanceEntryCallback: ?() => void;
26
35
 
27
- const NativePerformanceObserverMock: NativePerformanceObserver = {
28
- startReporting: (entryType: RawPerformanceEntryType) => {
29
- reportingType.add(entryType);
30
- },
36
+ export function logMockEntry(entry: RawPerformanceEntry) {
37
+ entries.push(entry);
31
38
 
32
- stopReporting: (entryType: RawPerformanceEntryType) => {
33
- reportingType.delete(entryType);
34
- durationThresholds.delete(entryType);
35
- },
39
+ if (entry.entryType === RawPerformanceEntryTypeValues.EVENT) {
40
+ eventCounts.set(entry.name, (eventCounts.get(entry.name) ?? 0) + 1);
41
+ }
42
+
43
+ for (const observer of observers) {
44
+ if (
45
+ observer.options.type !== entry.entryType &&
46
+ !observer.options.entryTypes?.includes(entry.entryType)
47
+ ) {
48
+ continue;
49
+ }
36
50
 
37
- setIsBuffered: (
38
- entryTypes: $ReadOnlyArray<RawPerformanceEntryType>,
39
- isBuffered: boolean,
40
- ) => {
41
- for (const entryType of entryTypes) {
42
- if (isBuffered) {
43
- isAlwaysLogged.add(entryType);
44
- } else {
45
- isAlwaysLogged.delete(entryType);
51
+ if (entry.entryType === RawPerformanceEntryTypeValues.EVENT) {
52
+ const {durationThreshold = 0} = observer.options;
53
+ if (durationThreshold > 0 && entry.duration < durationThreshold) {
54
+ continue;
46
55
  }
47
56
  }
57
+
58
+ observer.entries.push(entry);
59
+
60
+ // $FlowFixMe[incompatible-call]
61
+ global.queueMicrotask(() => {
62
+ // We want to emulate the way it's done in native (i.e. async/batched)
63
+ observer.callback();
64
+ });
65
+ }
66
+ }
67
+
68
+ type MockObserver = {
69
+ callback: NativeBatchedObserverCallback,
70
+ entries: Array<RawPerformanceEntry>,
71
+ options: PerformanceObserverInit,
72
+ droppedEntriesCount: number,
73
+ };
74
+
75
+ const NativePerformanceObserverMock: NativePerformanceObserver = {
76
+ getEventCounts: (): $ReadOnlyArray<[string, number]> => {
77
+ return Array.from(eventCounts.entries());
48
78
  },
49
79
 
50
- popPendingEntries: (): GetPendingEntriesResult => {
51
- const res = entries;
52
- entries = [];
53
- return {
80
+ createObserver: (
81
+ callback: NativeBatchedObserverCallback,
82
+ ): OpaqueNativeObserverHandle => {
83
+ const observer: MockObserver = {
84
+ callback,
85
+ entries: [],
86
+ options: {},
54
87
  droppedEntriesCount: 0,
55
- entries: res,
56
88
  };
89
+
90
+ return observer;
57
91
  },
58
92
 
59
- setOnPerformanceEntryCallback: (callback?: () => void) => {
60
- onPerformanceEntryCallback = callback;
93
+ getDroppedEntriesCount: (observer: OpaqueNativeObserverHandle): number => {
94
+ // $FlowFixMe
95
+ const mockObserver = (observer: any) as MockObserver;
96
+ return mockObserver.droppedEntriesCount;
61
97
  },
62
98
 
63
- logRawEntry: (entry: RawPerformanceEntry) => {
64
- if (
65
- reportingType.has(entry.entryType) ||
66
- isAlwaysLogged.has(entry.entryType)
67
- ) {
68
- const durationThreshold = durationThresholds.get(entry.entryType);
69
- if (
70
- durationThreshold !== undefined &&
71
- entry.duration < durationThreshold
72
- ) {
73
- return;
74
- }
75
- entries.push(entry);
76
- // $FlowFixMe[incompatible-call]
77
- global.queueMicrotask(() => {
78
- // We want to emulate the way it's done in native (i.e. async/batched)
79
- onPerformanceEntryCallback?.();
80
- });
81
- }
82
- if (entry.entryType === RawPerformanceEntryTypeValues.EVENT) {
83
- eventCounts.set(entry.name, (eventCounts.get(entry.name) ?? 0) + 1);
84
- }
99
+ observe: (
100
+ observer: OpaqueNativeObserverHandle,
101
+ options: PerformanceObserverInit,
102
+ ): void => {
103
+ // $FlowFixMe
104
+ const mockObserver = (observer: any) as MockObserver;
105
+ mockObserver.options = options;
106
+ observers.push(mockObserver);
85
107
  },
86
108
 
87
- getEventCounts: (): $ReadOnlyArray<[string, number]> => {
88
- return Array.from(eventCounts.entries());
109
+ disconnect: (observer: OpaqueNativeObserverHandle): void => {
110
+ // $FlowFixMe
111
+ const mockObserver = (observer: any) as MockObserver;
112
+ observers = observers.filter(e => e !== mockObserver);
89
113
  },
90
114
 
91
- setDurationThreshold: (
92
- entryType: RawPerformanceEntryType,
93
- durationThreshold: number,
94
- ) => {
95
- durationThresholds.set(entryType, durationThreshold);
115
+ takeRecords: (
116
+ observer: OpaqueNativeObserverHandle,
117
+ ): $ReadOnlyArray<RawPerformanceEntry> => {
118
+ // $FlowFixMe
119
+ const mockObserver = (observer: any) as MockObserver;
120
+ const observerEntries = mockObserver.entries;
121
+ mockObserver.entries = [];
122
+ return observerEntries;
96
123
  },
97
124
 
98
125
  clearEntries: (entryType?: RawPerformanceEntryType, entryName?: string) => {
@@ -50,7 +50,7 @@ declare module '.' {
50
50
  }
51
51
 
52
52
  export interface ViewStyle {
53
- experimental_mixBlendMode?: BlendMode | undefined;
53
+ mixBlendMode?: BlendMode | undefined;
54
54
  experimental_backgroundImage?:
55
55
  | ReadonlyArray<GradientValue>
56
56
  | string
package/types/index.d.ts CHANGED
@@ -104,7 +104,6 @@ export * from '../Libraries/Components/View/ViewAccessibility';
104
104
  export * from '../Libraries/Components/View/ViewPropTypes';
105
105
  export * from '../Libraries/Components/Button';
106
106
  export * from '../Libraries/Core/registerCallableModule';
107
- export * from '../Libraries/DevToolsSettings/DevToolsSettingsManager';
108
107
  export * from '../Libraries/EventEmitter/NativeEventEmitter';
109
108
  export * from '../Libraries/EventEmitter/RCTDeviceEventEmitter';
110
109
  export * from '../Libraries/EventEmitter/RCTNativeAppEventEmitter';
@@ -142,6 +141,7 @@ export * as TurboModuleRegistry from '../Libraries/TurboModule/TurboModuleRegist
142
141
  export * from '../Libraries/Types/CoreEventTypes';
143
142
  export * from '../Libraries/Utilities/Appearance';
144
143
  export * from '../Libraries/Utilities/BackHandler';
144
+ export * from '../src/private/devmenu/DevMenu';
145
145
  export * from '../Libraries/Utilities/DevSettings';
146
146
  export * from '../Libraries/Utilities/Dimensions';
147
147
  export * from '../Libraries/Utilities/PixelRatio';
@@ -111,10 +111,6 @@ export interface NativeMethods {
111
111
  * Removes focus from an input or view. This is the opposite of `focus()`.
112
112
  */
113
113
  blur(): void;
114
-
115
- refs: {
116
- [key: string]: React.Component<any, any>;
117
- };
118
114
  }
119
115
 
120
116
  /**
@@ -1,35 +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 DevSettings from '../Utilities/DevSettings';
12
- import NativeDevToolsSettingsManager from './NativeDevToolsSettingsManager';
13
-
14
- module.exports = {
15
- setConsolePatchSettings(newSettings: string) {
16
- NativeDevToolsSettingsManager?.setConsolePatchSettings(newSettings);
17
- },
18
- getConsolePatchSettings(): ?string {
19
- return NativeDevToolsSettingsManager?.getConsolePatchSettings();
20
- },
21
- setProfilingSettings(newSettings: string) {
22
- if (NativeDevToolsSettingsManager?.setProfilingSettings != null) {
23
- NativeDevToolsSettingsManager.setProfilingSettings(newSettings);
24
- }
25
- },
26
- getProfilingSettings(): ?string {
27
- if (NativeDevToolsSettingsManager?.getProfilingSettings != null) {
28
- return NativeDevToolsSettingsManager.getProfilingSettings();
29
- }
30
- return null;
31
- },
32
- reload(): void {
33
- DevSettings?.reload();
34
- },
35
- };
@@ -1,20 +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 interface DevToolsSettingsManagerStatic {
12
- reload(): void;
13
- setConsolePatchSettings(newSettings: string): void;
14
- getConsolePatchSettings(): string | null;
15
- setProfilingSettings(newSettings: string): void;
16
- getProfilingSettings(): string | null;
17
- }
18
-
19
- export const DevToolsSettingsManager: DevToolsSettingsManagerStatic;
20
- export type DevToolsSettingsManager = DevToolsSettingsManagerStatic;
@@ -1,49 +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 Settings from '../Settings/Settings';
12
- import DevSettings from '../Utilities/DevSettings';
13
-
14
- const CONSOLE_PATCH_SETTINGS_KEY = 'ReactDevTools::ConsolePatchSettings';
15
- const PROFILING_SETTINGS_KEY = 'ReactDevTools::ProfilingSettings';
16
-
17
- const DevToolsSettingsManager = {
18
- setConsolePatchSettings(newConsolePatchSettings: string): void {
19
- Settings.set({
20
- [CONSOLE_PATCH_SETTINGS_KEY]: newConsolePatchSettings,
21
- });
22
- },
23
- getConsolePatchSettings(): ?string {
24
- const value = Settings.get(CONSOLE_PATCH_SETTINGS_KEY);
25
- if (typeof value === 'string') {
26
- return value;
27
- }
28
- return null;
29
- },
30
-
31
- setProfilingSettings(newProfilingSettings: string): void {
32
- Settings.set({
33
- [PROFILING_SETTINGS_KEY]: newProfilingSettings,
34
- });
35
- },
36
- getProfilingSettings(): ?string {
37
- const value = Settings.get(PROFILING_SETTINGS_KEY);
38
- if (typeof value === 'string') {
39
- return value;
40
- }
41
- return null;
42
- },
43
-
44
- reload(): void {
45
- DevSettings?.reload();
46
- },
47
- };
48
-
49
- module.exports = DevToolsSettingsManager;
@@ -1,35 +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 DevSettings from '../Utilities/DevSettings';
12
- import NativeDevToolsSettingsManager from './NativeDevToolsSettingsManager';
13
-
14
- module.exports = {
15
- setConsolePatchSettings(newSettings: string) {
16
- NativeDevToolsSettingsManager?.setConsolePatchSettings(newSettings);
17
- },
18
- getConsolePatchSettings(): ?string {
19
- return NativeDevToolsSettingsManager?.getConsolePatchSettings();
20
- },
21
- setProfilingSettings(newSettings: string) {
22
- if (NativeDevToolsSettingsManager?.setProfilingSettings != null) {
23
- NativeDevToolsSettingsManager.setProfilingSettings(newSettings);
24
- }
25
- },
26
- getProfilingSettings(): ?string {
27
- if (NativeDevToolsSettingsManager?.getProfilingSettings != null) {
28
- return NativeDevToolsSettingsManager.getProfilingSettings();
29
- }
30
- return null;
31
- },
32
- reload(): void {
33
- DevSettings?.reload();
34
- },
35
- };
@@ -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/NativeDevToolsSettingsManager';
12
- import NativeDevToolsSettingsManager from '../../src/private/specs/modules/NativeDevToolsSettingsManager';
13
- export default NativeDevToolsSettingsManager;