Skip to content

Force native EventTarget event dispatching on for the React renderer - #59911

Merged
rubennorte merged 3 commits into
react:mainfrom
rubennorte:fix-renderer-event-target-dispatch-flag
Nov 10, 2026
Merged

rubennorte merged 3 commits into
react:mainfrom
rubennorte:fix-renderer-event-target-dispatch-flag

Conversation

@rubennorte

@rubennorte rubennorte commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary:

#59896 removed enableNativeEventTargetEventDispatching from ReactNativeFeatureFlags, but the vendored Fabric renderer still reads it through react-native/react-private-interface to choose between dispatchNativeEvent and the legacy plugin-based dispatch. With the getter gone, the renderer saw undefined, treated the flag as off, and fell back to the legacy path, so listeners registered with addEventListener were never called.

The ReactNativeFeatureFlags getter in the private interface now returns the real flags plus enableNativeEventTargetEventDispatching: () => true, so only the renderer sees it. This can be removed once the renderer is synced from a React build that no longer reads the flag.

UPDATE: Also fixes 2 other breakages (outdated Fantom snapshot and generated TS types)

Changelog:

[Internal]

Test Plan:

  • yarn fantom packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js: 16 failures before, 78 passed / 20 skipped after.
  • yarn fantom packages/react-native/src/private/webapis/dom packages/react-native/src/private/renderer: 513 passed, 26 skipped.
  • yarn eslint --max-warnings 0 and yarn prettier --check on both changed files pass.
  • yarn flow-check reports only 2 unrelated parse errors from local git ref logs under .git/logs/refs/remotes/ whose names end in .json.

## Summary:

react#59896 removed `enableNativeEventTargetEventDispatching` from `ReactNativeFeatureFlags`, but the vendored Fabric renderer still reads it through `react-native/react-private-interface` to choose between `dispatchNativeEvent` and the legacy plugin-based dispatch. With the getter gone, the renderer saw `undefined`, treated the flag as off, and fell back to the legacy path, so listeners registered with `addEventListener` were never called.

The `ReactNativeFeatureFlags` getter in the private interface now returns the real flags plus `enableNativeEventTargetEventDispatching: () => true`, so only the renderer sees it. This can be removed once the renderer is synced from a React build that no longer reads the flag.

## Changelog:

[Internal]

## Test Plan:

- `yarn fantom packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js`: 16 failures before, 78 passed / 20 skipped after.
- `yarn fantom packages/react-native/src/private/webapis/dom packages/react-native/src/private/renderer`: 513 passed, 26 skipped.
- `yarn eslint --max-warnings 0` and `yarn prettier --check` on both changed files pass.
- `yarn flow-check` reports only 2 unrelated parse errors from local git ref logs under `.git/logs/refs/remotes/` whose names end in `.json`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@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 Nov 10, 2026
@javache

javache commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Wouldn't this force all the properties to materialize? Why not add it back to the react feature flags config with default true?

@rubennorte

Copy link
Copy Markdown
Member Author

Wouldn't this force all the properties to materialize? Why not add it back to the react feature flags config with default true?

They'd be materialized anyway, but it's only the accessor functions, not the underlying flag read.

Summary:
react#59896 made `ReactNativeElement` unconditionally extend `EventTarget`, which
imports the `AbortSignal` type, pulling `AbortSignal.d.ts` into the generated
types checked by `yarn test-generated-typescript`. The internal
`abortSignal(reason = ..., signal)` helper declares a defaulted parameter before
a required one, which flow-api-translator emits as
`abortSignal(reason?: unknown | void, signal: AbortSignal)` and tsc rejects with
TS1016.

Reorder the parameters to `abortSignal(signal, reason = ...)` and update both
internal callers. The public API snapshot is unchanged.

Changelog: [Internal]

Test Plan:
- `yarn build-types --skip-snapshot && yarn test-generated-typescript`: fails
  with TS1016 before, passes after
- `yarn build-types --validate`: API snapshot is up to date
- `yarn eslint --max-warnings 0 packages/react-native/src/private/webapis/dom/abort-api/`
@rubennorte rubennorte changed the title Force native EventTarget event dispatching on for the React renderer [Fix CI] Force native EventTarget event dispatching on for the React renderer Nov 10, 2026
@rubennorte rubennorte changed the title [Fix CI] Force native EventTarget event dispatching on for the React renderer Force native EventTarget event dispatching on for the React renderer Nov 10, 2026
## Summary:

react#59797 added `experimental_onSafeAreaInsetsChange` to the root `logbox_inspector` view, and react#59893 refreshed the LogBox snapshots without that change, so both landed but the committed `LogBoxInspector` baseline is missing the prop. The two inspector snapshot tests fail in Fantom CI mode, which no longer rewrites mismatched baselines (react#59895).

Regenerate the two affected snapshots; the only change is the added prop on the root view.

## Changelog:

[Internal]

## Test Plan:

- `CI=true yarn fantom packages/react-native/Libraries/LogBox`: 2 snapshot failures before; 90/90 tests and 54/54 snapshots pass after, on two consecutive runs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@rubennorte
rubennorte merged commit 3b5ea13 into react:main Nov 10, 2026
88 checks passed
@rubennorte
rubennorte deleted the fix-renderer-event-target-dispatch-flag branch November 10, 2026 17:00
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. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants