Commit d1a8a1f
EventTarget-based event dispatching (#56427)
Summary:
Pull Request resolved: #56427
Changelog: [internal]
## Context
The current React Native Fabric renderer uses a legacy plugin-based
event system (ResponderEventPlugin, ReactNativeBridgeEventPlugin,
pooled SyntheticEvent objects) that duplicates dispatch logic already
provided by the W3C EventTarget API. This adds complexity, prevents
alignment with the Web platform, and blocks EventTarget-based features.
## Changes
Behind the `enableNativeEventTargetEventDispatching` flag, native events
are dispatched through `dispatchTrustedEvent` on the public instance
tree instead of the legacy plugin system. Event handler props are
extracted from `canonical.currentProps` at dispatch time via a
declarative listener hook on EventTarget — no `addEventListener`
registration at commit time.
The responder system is fully self-contained: it walks the public
instance tree directly for negotiation, calls handlers from props, and
inspects return values inline (e.g. `onResponderGrant` returning `true`
blocks native). It has no EventTarget coupling and no commit-time cost.
Reviewed By: javache, jackpope
Differential Revision: D100462547
fbshipit-source-id: f6422544ad0ea091c26a3c2abf82dc3679d706f31 parent 467af1e commit d1a8a1f
23 files changed
Lines changed: 3889 additions & 137 deletions
File tree
- packages/react-native
- Libraries
- ReactNative
- ReactPrivate
- scripts/featureflags
- src/private
- featureflags
- renderer
- core/__tests__
- events
- setup
- webapis/dom
- events
- __tests__
- internals
- nodes
- __tests__
- internals
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| 132 | + | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
| |||
Lines changed: 4 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | | - | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
145 | 140 | | |
146 | 141 | | |
0 commit comments