Remove lowercase timestamp fallback in event timestamp injection (#56512)

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

Changelog: [internal]

`UIManagerBinding::dispatchEvent` injects a `timeStamp` property into the event payload when one is not already present. A previous change extended this check to also skip injection when a lowercase `timestamp` property was present, so that native events using the lowercase form would have their timestamp preserved.

That was done to fix a failing Fantom test but what was wrong was the test itself. This removes the test and reverts that previous fix.

Reviewed By: javache

Differential Revision: D101649991

fbshipit-source-id: 933c906403f2e4144575b89e11f96feb8775f455
This commit is contained in:
Rubén Norte authored and meta-codesync[bot] committed 2026-04-21 04:44:56 -07:00
1 parent 70281d6d0e
commit cf1975f1c3
2 files changed
+1 -34

No files matched your search

@@ -147,8 +147,7 @@ void UIManagerBinding::dispatchEventToJS(
// Add timestamp to payload if not already set
if (payload.isObject()) {
auto payloadObject = payload.asObject(runtime);
if (!payloadObject.hasProperty(runtime, "timeStamp") &&
!payloadObject.hasProperty(runtime, "timestamp")) {
if (!payloadObject.hasProperty(runtime, "timeStamp")) {
payloadObject.setProperty(
runtime, "timeStamp", eventTimestamp.toDOMHighResTimeStamp());
}
@@ -55,38 +55,6 @@ describe('Event Dispatching', () => {
);
});
it('provides the native event timestamp (lower case) when available', () => {
const root = Fantom.createRoot();
const ref = React.createRef<React.ElementRef<typeof View>>();
const onPointerUp = jest.fn((e: PointerEvent) => {
e.persist();
});
Fantom.runTask(() => {
root.render(<View ref={ref} onPointerUp={onPointerUp} />);
});
expect(onPointerUp).toHaveBeenCalledTimes(0);
const NATIVE_EVENT_TIMESTAMP = 1234;
Fantom.dispatchNativeEvent(
ref,
'onPointerUp',
{x: 0, y: 0, timestamp: NATIVE_EVENT_TIMESTAMP},
{
category: Fantom.NativeEventCategory.Discrete,
},
);
expect(onPointerUp).toHaveBeenCalledTimes(1);
expect(onPointerUp.mock.calls[0][0].timeStamp).toBe(
NATIVE_EVENT_TIMESTAMP,
);
});
it('provides a default timeStamp when the native event timeStamp is NOT available', () => {
const root = Fantom.createRoot();