@office-iss/react-native-win32 0.0.0-canary.272 → 0.0.0-canary.273

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 (51) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +16 -1
  3. package/CHANGELOG.md +12 -4
  4. package/Libraries/Animated/AnimatedEvent.js +1 -1
  5. package/Libraries/Animated/animations/Animation.js +1 -1
  6. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  7. package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
  8. package/Libraries/Animated/nodes/AnimatedProps.js +1 -1
  9. package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
  10. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  11. package/Libraries/Animated/useAnimatedProps.js +3 -3
  12. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +5 -0
  13. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +2 -2
  14. package/Libraries/Components/TextInput/TextInput.d.ts +4 -0
  15. package/Libraries/Components/TextInput/TextInput.flow.js +2 -0
  16. package/Libraries/Components/TextInput/TextInput.js +2 -0
  17. package/Libraries/Components/TextInput/TextInput.win32.js +2 -0
  18. package/Libraries/Components/View/ViewNativeComponent.js +3 -88
  19. package/Libraries/Core/ReactNativeVersion.js +1 -1
  20. package/Libraries/Core/setUpReactDevTools.js +74 -1
  21. package/Libraries/Core/setUpTimers.js +21 -10
  22. package/Libraries/Image/Image.android.js +1 -3
  23. package/Libraries/Image/Image.ios.js +0 -2
  24. package/Libraries/Image/Image.win32.js +0 -2
  25. package/Libraries/Inspector/Inspector.js +1 -0
  26. package/Libraries/Inspector/Inspector.win32.js +1 -0
  27. package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
  28. package/Libraries/Modal/Modal.js +3 -0
  29. package/Libraries/NativeComponent/BaseViewConfig.android.js +65 -0
  30. package/Libraries/ReactNative/AppRegistry.js +1 -1
  31. package/Libraries/Renderer/shims/ReactNativeTypes.js +1 -9
  32. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  33. package/Libraries/StyleSheet/StyleSheetTypes.js +1 -1
  34. package/Libraries/Utilities/FocusManager.win32.js +1 -1
  35. package/Libraries/Utilities/useMergeRefs.js +26 -7
  36. package/index.js +1 -1
  37. package/index.win32.js +1 -1
  38. package/jest/setup.js +1 -0
  39. package/overrides.json +8 -8
  40. package/package.json +12 -12
  41. package/src/private/animated/NativeAnimatedHelper.js +4 -4
  42. package/src/private/animated/NativeAnimatedHelper.win32.js +4 -4
  43. package/src/private/animated/useAnimatedPropsMemo.js +0 -1
  44. package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +2 -1
  45. package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -11
  46. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -3
  47. package/src/private/webapis/performance/EventTiming.js +1 -1
  48. package/src/private/webapis/performance/Performance.js +36 -15
  49. package/src/private/webapis/performance/PerformanceObserver.js +2 -2
  50. package/src/private/webapis/performance/specs/NativePerformance.js +18 -2
  51. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +32 -12
@@ -12,8 +12,8 @@
12
12
 
13
13
  import type {
14
14
  DOMHighResTimeStamp,
15
- PerformanceEntryType,
16
15
  PerformanceEntryList,
16
+ PerformanceEntryType,
17
17
  } from './PerformanceEntry';
18
18
  import type {DetailType, PerformanceMarkOptions} from './UserTiming';
19
19
 
@@ -109,15 +109,24 @@ export default class Performance {
109
109
  markName: string,
110
110
  markOptions?: PerformanceMarkOptions,
111
111
  ): PerformanceMark {
112
- const mark = new PerformanceMark(markName, markOptions);
113
-
114
- if (NativePerformance?.mark) {
115
- NativePerformance.mark(markName, mark.startTime);
112
+ let computedStartTime;
113
+ if (NativePerformance?.markWithResult) {
114
+ computedStartTime = NativePerformance.markWithResult(
115
+ markName,
116
+ markOptions?.startTime,
117
+ );
118
+ } else if (NativePerformance?.mark) {
119
+ computedStartTime = markOptions?.startTime ?? performance.now();
120
+ NativePerformance?.mark?.(markName, computedStartTime);
116
121
  } else {
117
122
  warnNoNativePerformance();
123
+ computedStartTime = performance.now();
118
124
  }
119
125
 
120
- return mark;
126
+ return new PerformanceMark(markName, {
127
+ startTime: computedStartTime,
128
+ detail: markOptions?.detail,
129
+ });
121
130
  }
122
131
 
123
132
  clearMarks(markName?: string): void {
@@ -143,6 +152,7 @@ export default class Performance {
143
152
 
144
153
  if (typeof startMarkOrOptions === 'string') {
145
154
  startMarkName = startMarkOrOptions;
155
+ options = {};
146
156
  } else if (startMarkOrOptions !== undefined) {
147
157
  options = startMarkOrOptions;
148
158
  if (endMark !== undefined) {
@@ -180,15 +190,20 @@ export default class Performance {
180
190
  duration = options.duration ?? duration;
181
191
  }
182
192
 
183
- const measure = new PerformanceMeasure(measureName, {
184
- // FIXME(T196011255): this is incorrect, as we're only assigning the
185
- // start/end if they're specified as a number, but not if they're
186
- // specified as previous mark names.
187
- startTime,
188
- duration,
189
- });
190
-
191
- if (NativePerformance?.measure) {
193
+ let computedStartTime = startTime;
194
+ let computedDuration = duration;
195
+
196
+ if (NativePerformance?.measureWithResult) {
197
+ [computedStartTime, computedDuration] =
198
+ NativePerformance.measureWithResult(
199
+ measureName,
200
+ startTime,
201
+ endTime,
202
+ duration,
203
+ startMarkName,
204
+ endMarkName,
205
+ );
206
+ } else if (NativePerformance?.measure) {
192
207
  NativePerformance.measure(
193
208
  measureName,
194
209
  startTime,
@@ -201,6 +216,12 @@ export default class Performance {
201
216
  warnNoNativePerformance();
202
217
  }
203
218
 
219
+ const measure = new PerformanceMeasure(measureName, {
220
+ startTime: computedStartTime,
221
+ duration: computedDuration,
222
+ detail: options?.detail,
223
+ });
224
+
204
225
  return measure;
205
226
  }
206
227
 
@@ -10,9 +10,10 @@
10
10
 
11
11
  import type {
12
12
  DOMHighResTimeStamp,
13
- PerformanceEntryType,
14
13
  PerformanceEntryList,
14
+ PerformanceEntryType,
15
15
  } from './PerformanceEntry';
16
+ import type {OpaqueNativeObserverHandle} from './specs/NativePerformance';
16
17
 
17
18
  import {PerformanceEventTiming} from './EventTiming';
18
19
  import {
@@ -21,7 +22,6 @@ import {
21
22
  rawToPerformanceEntryType,
22
23
  } from './RawPerformanceEntry';
23
24
  import NativePerformance from './specs/NativePerformance';
24
- import type {OpaqueNativeObserverHandle} from './specs/NativePerformance';
25
25
  import {warnNoNativePerformance} from './Utilities';
26
26
 
27
27
  export {PerformanceEntry} from './PerformanceEntry';
@@ -33,6 +33,8 @@ export type RawPerformanceEntry = {
33
33
  export type OpaqueNativeObserverHandle = mixed;
34
34
 
35
35
  export type NativeBatchedObserverCallback = () => void;
36
+ export type NativePerformanceMarkResult = number;
37
+ export type NativePerformanceMeasureResult = $ReadOnlyArray<number>; // [startTime, duration]
36
38
 
37
39
  export type PerformanceObserverInit = {
38
40
  entryTypes?: $ReadOnlyArray<number>,
@@ -43,8 +45,10 @@ export type PerformanceObserverInit = {
43
45
 
44
46
  export interface Spec extends TurboModule {
45
47
  +now?: () => number;
46
- +mark: (name: string, startTime: number) => void;
47
- +measure: (
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?: (
48
52
  name: string,
49
53
  startTime: number,
50
54
  endTime: number,
@@ -52,6 +56,18 @@ export interface Spec extends TurboModule {
52
56
  startMark?: string,
53
57
  endMark?: string,
54
58
  ) => void;
59
+ +markWithResult?: (
60
+ name: string,
61
+ startTime?: number,
62
+ ) => NativePerformanceMarkResult;
63
+ +measureWithResult?: (
64
+ name: string,
65
+ startTime: number,
66
+ endTime: number,
67
+ duration?: number,
68
+ startMark?: string,
69
+ endMark?: string,
70
+ ) => NativePerformanceMeasureResult;
55
71
  +clearMarks?: (entryName?: string) => void;
56
72
  +clearMeasures?: (entryName?: string) => void;
57
73
  +getEntries?: () => $ReadOnlyArray<RawPerformanceEntry>;
@@ -11,13 +11,14 @@
11
11
  import type {
12
12
  NativeBatchedObserverCallback,
13
13
  NativeMemoryInfo,
14
- RawPerformanceEntry,
15
- ReactNativeStartupTiming,
16
- PerformanceObserverInit,
14
+ NativePerformanceMarkResult,
15
+ NativePerformanceMeasureResult,
17
16
  OpaqueNativeObserverHandle,
17
+ PerformanceObserverInit,
18
+ RawPerformanceEntry,
18
19
  RawPerformanceEntryType,
20
+ ReactNativeStartupTiming,
19
21
  } from '../NativePerformance';
20
-
21
22
  import typeof NativePerformance from '../NativePerformance';
22
23
 
23
24
  import {RawPerformanceEntryTypeValues} from '../../RawPerformanceEntry';
@@ -109,32 +110,51 @@ const NativePerformanceMock = {
109
110
 
110
111
  now: (): number => currentTime,
111
112
 
112
- mark: (name: string, startTime: number): void => {
113
- marks.set(name, startTime);
113
+ markWithResult: (
114
+ name: string,
115
+ startTime?: number,
116
+ ): NativePerformanceMarkResult => {
117
+ const computedStartTime = startTime ?? performance.now();
118
+
119
+ marks.set(name, computedStartTime);
114
120
  reportEntry({
115
121
  entryType: RawPerformanceEntryTypeValues.MARK,
116
122
  name,
117
- startTime,
123
+ startTime: computedStartTime,
118
124
  duration: 0,
119
125
  });
126
+
127
+ return computedStartTime;
120
128
  },
121
129
 
122
- measure: (
130
+ measureWithResult: (
123
131
  name: string,
124
132
  startTime: number,
125
133
  endTime: number,
126
134
  duration?: number,
127
135
  startMark?: string,
128
136
  endMark?: string,
129
- ): void => {
130
- const start = startMark != null ? marks.get(startMark) ?? 0 : startTime;
131
- const end = endMark != null ? marks.get(endMark) ?? 0 : endTime;
137
+ ): NativePerformanceMeasureResult => {
138
+ const start = startMark != null ? marks.get(startMark) : startTime;
139
+ const end = endMark != null ? marks.get(endMark) : endTime;
140
+
141
+ if (start === undefined) {
142
+ throw new Error('startMark does not exist');
143
+ }
144
+
145
+ if (end === undefined) {
146
+ throw new Error('endMark does not exist');
147
+ }
148
+
149
+ const computedDuration = duration ?? end - start;
132
150
  reportEntry({
133
151
  entryType: RawPerformanceEntryTypeValues.MEASURE,
134
152
  name,
135
153
  startTime: start,
136
- duration: duration ?? end - start,
154
+ duration: computedDuration,
137
155
  });
156
+
157
+ return [start, computedDuration];
138
158
  },
139
159
 
140
160
  getSimpleMemoryInfo: (): NativeMemoryInfo => {