@samitouri / QOS-React-2 / commits / 4cc5b7a90b

Add support for event information in React scheduler tracks in React Native (#35947)

## Summary This defines the same fiber configuration for RN as used in DOM, so we can expose event timing information in the React scheduler tracks in performance traces. This was unblocked by #35913 and #35912. ## How did you test this change? Manually compiled the renderer and tested e2e in FB infra: <img width="1217" height="161" alt="Screenshot 2026-03-03 at 10 10 44" src="https://github.com/user-attachments/assets/6ca1512e-dcaf-49cf-8da9-1c6ae554733a" />

Rubén Norte committed Mar 3, 2026 at 13:12 UTC 4cc5b7a90bac7e1f8ac51a9ac570d3ada3bddcb3
1 file changed +37 -3
packages/react-native-renderer/src/ReactFiberConfigFabric.js
+37 -3
@@ -422,14 +422,48 @@ export function resolveUpdatePriority(): EventPriority {
422 return DefaultEventPriority;
423 }
424
425 -export function trackSchedulerEvent(): void {}
425 +let schedulerEvent: void | Event = undefined;
426 +export function trackSchedulerEvent(): void {
427 + schedulerEvent = global.event;
428 +}
429 +
430 +function getEventType(event: Event): null | string {
431 + if (event.type) {
432 + return event.type;
433 + }
434 +
435 + // Legacy implementation. RN does not define the `type` property on the event object yet.
436 + // $FlowExpectedError[prop-missing]
437 + const dispatchConfig = event.dispatchConfig;
438 + if (
439 + dispatchConfig == null ||
440 + dispatchConfig.phasedRegistrationNames == null
441 + ) {
442 + return null;
443 + }
444 +
445 + const rawEventType =
446 + dispatchConfig.phasedRegistrationNames.bubbled ||
447 + dispatchConfig.phasedRegistrationNames.captured;
448 + if (!rawEventType) {
449 + return null;
450 + }
451 +
452 + if (rawEventType.startsWith('on')) {
453 + return rawEventType.slice(2).toLowerCase();
454 + }
455 +
456 + return rawEventType.toLowerCase();
457 +}
458
459 export function resolveEventType(): null | string {
428 - return null;
460 + const event = global.event;
461 + return event && event !== schedulerEvent ? getEventType(event) : null;
462 }
463
464 export function resolveEventTimeStamp(): number {
432 - return -1.1;
465 + const event = global.event;
466 + return event && event !== schedulerEvent ? event.timeStamp : -1.1;
467 }
468
469 export function shouldAttemptEagerTransition(): boolean {