Skip to content

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

Closed
rubennorte wants to merge 1 commit intofacebook:mainfrom
rubennorte:export-D99076591
Closed

Add support for custom timestamps in Event via EVENT_INIT_TIMESTAMP_KEY (#56304)#56304
rubennorte wants to merge 1 commit intofacebook:mainfrom
rubennorte:export-D99076591

Conversation

@rubennorte
Copy link
Copy Markdown
Contributor

@rubennorte rubennorte commented Apr 1, 2026

Summary:

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

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 1, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 1, 2026

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99076591.

@facebook-github-tools facebook-github-tools bot added p: Facebook Partner: Facebook Partner labels Apr 1, 2026
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 1, 2026
…EY (facebook#56304)

Summary:

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]

Differential Revision: D99076591
rubennorte added a commit to rubennorte/react-native that referenced this pull request Apr 1, 2026
…EY (facebook#56304)

Summary:

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]

Differential Revision: D99076591
…EY (facebook#56304)

Summary:

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
@meta-codesync meta-codesync bot changed the title Add support for custom timestamps in Event via EVENT_INIT_TIMESTAMP_KEY Add support for custom timestamps in Event via EVENT_INIT_TIMESTAMP_KEY (#56304) Apr 1, 2026
@meta-codesync meta-codesync bot closed this in e7564d6 Apr 1, 2026
@facebook-github-tools facebook-github-tools bot added the Merged This PR has been merged. label Apr 1, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 1, 2026

This pull request has been merged in e7564d6.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @rubennorte in e7564d6

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants