SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Add support for custom timestamps in Event via EVENT_INIT_TIMESTAMP_KEY (#56304)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56304

Add support for specifying a custom `timeStamp` in the `Event` constructor options via a private symbol key (`EVENT_INIT_TIMESTAMP_KEY`) defined in `EventInternals`. This is for internal construction of events using a custom timestamp (instead of event object creation), for use cases like dispatching events from the host platform using the original timestamps.

- Added `EVENT_INIT_TIMESTAMP_KEY` symbol to `EventInternals`
- Added `setEventInitTimeStamp(eventInit, timeStamp)` helper function in `EventInternals` that validates the type and sets the symbol-keyed property on the event init object
- Updated the `Event` constructor to read the custom timestamp from options if present, falling back to `performance.now()`
- Added Fantom tests for custom timestamp and zero as a valid timestamp

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D99076591

fbshipit-source-id: 2ea00394de885a5f338c1b3fe4792d5b4768cd7b
R
Rubén Norte committed
e7564d6a135087e63eb1fdbc4d21083667e8f9eb
Parent: 654d646
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 4/1/2026, 5:50:36 PM