mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix incorrect type being passed to NativePerformance.mark (#47102)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47102 Changelog: [internal] In D64466057 / https://github.com/facebook/react-native/commit/32f7b3b4e0b8be1d1138f43c46b3c86d9a64c29a we accidentally modified the API of `NativePerformance.mark` (which we wanted to preserve and move the changes to `NativePerformance.markWithResult` after some iteration) to make `startTime` optional, which isn't compatible with the previous native API. This fixes the issue by reverting the type back to being required and always passing it from the JS API. Differential Revision: D64557467 fbshipit-source-id: 3ade4271622ac6213fd4c2d4948c7d40e4abe715
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d11954e800
commit
14bbb87516
@@ -116,13 +116,15 @@ export default class Performance {
|
||||
markOptions?.startTime,
|
||||
);
|
||||
} else if (NativePerformance?.mark) {
|
||||
NativePerformance.mark(markName, markOptions?.startTime);
|
||||
computedStartTime = markOptions?.startTime ?? performance.now();
|
||||
NativePerformance?.mark?.(markName, computedStartTime);
|
||||
} else {
|
||||
warnNoNativePerformance();
|
||||
computedStartTime = performance.now();
|
||||
}
|
||||
|
||||
return new PerformanceMark(markName, {
|
||||
startTime: computedStartTime ?? performance.now(),
|
||||
startTime: computedStartTime,
|
||||
detail: markOptions?.detail,
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ export type PerformanceObserverInit = {
|
||||
export interface Spec extends TurboModule {
|
||||
+now?: () => number;
|
||||
// TODO: remove when `markWithResult` is fully rolled out.
|
||||
+mark?: (name: string, startTime?: number) => void;
|
||||
+mark?: (name: string, startTime: number) => void;
|
||||
// TODO: remove when `measureWithResult` is fully rolled out.
|
||||
+measure?: (
|
||||
name: string,
|
||||
|
||||
Reference in New Issue
Block a user