@@ -30,21 +30,13 @@ import {runEventsInBatch} from './legacy-events/EventBatching';
3030
3131import {
3232 RawEventEmitter ,
33- ReactNativeViewConfigRegistry ,
34- dispatchTrustedEvent ,
35- setEventInitTimeStamp ,
33+ dispatchNativeEvent ,
3634} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' ;
3735import { getPublicInstance } from './ReactFiberConfigFabric' ;
38- import LegacySyntheticEvent from './LegacySyntheticEvent' ;
39- import { topLevelTypeToEventName } from './ReactNativeEventTypeMapping' ;
40- import { processResponderEvent } from './ReactNativeResponder' ;
4136import { enableNativeEventTargetEventDispatching } from './ReactNativeFeatureFlags' ;
4237
4338export { getListener , registrationNameModules as registrationNames } ;
4439
45- const { customBubblingEventTypes, customDirectEventTypes} =
46- ReactNativeViewConfigRegistry ;
47-
4840/**
4941 * Allows registered plugins an opportunity to extract events from top-level
5042 * native browser events.
@@ -143,38 +135,8 @@ export function dispatchEvent(
143135 RawEventEmitter . emit ( '*' , event ) ;
144136
145137 if ( enableNativeEventTargetEventDispatching ( ) ) {
146- // Process responder events before normal event dispatch.
147- // This handles touch negotiation (onStartShouldSetResponder, etc.)
148- processResponderEvent ( topLevelType , targetFiber , nativeEvent ) ;
149-
150- // New EventTarget-based dispatch path
151138 if ( eventTarget != null ) {
152- const bubbleDispatchConfig = customBubblingEventTypes [ topLevelType ] ;
153- const directDispatchConfig = customDirectEventTypes [ topLevelType ] ;
154- const bubbles = bubbleDispatchConfig != null ;
155-
156- // Skip events that are not registered in the view config
157- if ( bubbles || directDispatchConfig != null ) {
158- const eventName = topLevelTypeToEventName ( topLevelType ) ;
159- const options = {
160- bubbles,
161- cancelable : true ,
162- } ;
163- // Preserve the native event timestamp for backwards compatibility.
164- // The legacy SyntheticEvent system used nativeEvent.timeStamp || nativeEvent.timestamp.
165- const nativeTimestamp =
166- nativeEvent . timeStamp ?? nativeEvent . timestamp ;
167- if ( typeof nativeTimestamp === 'number' ) {
168- setEventInitTimeStamp ( options , nativeTimestamp ) ;
169- }
170- const syntheticEvent = new LegacySyntheticEvent (
171- eventName ,
172- options ,
173- nativeEvent ,
174- ) ;
175- // $FlowFixMe[incompatible-call]
176- dispatchTrustedEvent ( eventTarget , syntheticEvent ) ;
177- }
139+ dispatchNativeEvent ( eventTarget , topLevelType , nativeEvent ) ;
178140 }
179141 } else {
180142 // Heritage plugin event system
0 commit comments