Repository navigation
[RN] Call dispatchNativeEvent when the event target is null - #38007
Merged
Merged
Conversation
|
Comparing: fd51cb1...e7ce80f Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) Generated by sizebot against e7ce80f |
Rchie121
approved these changes
Oct 27, 2026
Rchie121
approved these changes
Oct 27, 2026
rubennorte
reviewed
Oct 27, 2026
| ): ?Object; | ||
| declare export function dispatchNativeEvent( | ||
| target: EventTarget, | ||
| target: null | EventTarget, |
Member
There was a problem hiding this comment.
Nit: more resilient as target: ?EventTarget
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 27, 2026
## Summary With `enableNativeEventTargetEventDispatching` on, the Fabric renderer skipped `dispatchNativeEvent` when the touched view had already unmounted, so the touch end never reached the JS responder and the next tap got lost. This passes the null target through instead, so React Native can still release the responder. It needs react/react-native#59522 to land first, since `dispatchNativeEvent` there throws on a null target today. Fixes #38006 ## How did you test this change? Added a test in `ReactFabric-test.internal.js` that unmounts a view, dispatches a touch end to its old instance handle, and expects `dispatchNativeEvent` to get a null target. It fails on main and passes with this change. Also ran `yarn test packages/react-native-renderer` (default, `--prod`, www-modern), `yarn flow fabric`, `yarn linc` and `yarn prettier-check`. DiffTrain build for [dc9aed3](dc9aed3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With
enableNativeEventTargetEventDispatchingon, the Fabric renderer skippeddispatchNativeEventwhen the touched view had already unmounted, so the touch end never reached the JS responder and the next tap got lost. This passes the null target through instead, so React Native can still release the responder. It needs react/react-native#59522 to land first, sincedispatchNativeEventthere throws on a null target today.Fixes #38006
How did you test this change?
Added a test in
ReactFabric-test.internal.jsthat unmounts a view, dispatches a touch end to its old instance handle, and expectsdispatchNativeEventto get a null target. It fails on main and passes with this change. Also ranyarn test packages/react-native-renderer(default,--prod, www-modern),yarn flow fabric,yarn lincandyarn prettier-check.