@@ -21,6 +21,7 @@ import getEventTarget from './getEventTarget';
2121import { getClosestInstanceFromNode } from '../client/ReactDOMComponentTree' ;
2222import SimpleEventPlugin from './SimpleEventPlugin' ;
2323import { getRawEventName } from './DOMTopLevelEventTypes' ;
24+ import { unsafeCastStringToDOMTopLevelType } from 'events/TopLevelEventTypes' ;
2425
2526const { isInteractiveTopLevelEventType} = SimpleEventPlugin ;
2627
@@ -48,7 +49,6 @@ function findRootContainerNode(inst) {
4849
4950// Used to store ancestor hierarchy in top level callback
5051function getTopLevelCallbackBookKeeping (
51- topLevelType ,
5252 nativeEvent ,
5353 targetInst ,
5454) : {
@@ -57,6 +57,8 @@ function getTopLevelCallbackBookKeeping(
5757 targetInst : Fiber | null ,
5858 ancestors : Array < Fiber > ,
5959} {
60+ const topLevelType = unsafeCastStringToDOMTopLevelType ( nativeEvent . type ) ;
61+
6062 if ( callbackBookkeepingPool . length ) {
6163 const instance = callbackBookkeepingPool . pop ( ) ;
6264 instance . topLevelType = topLevelType ;
@@ -149,7 +151,7 @@ export function trapBubbledEvent(
149151 element ,
150152 getRawEventName ( topLevelType ) ,
151153 // Check if interactive and wrap in interactiveUpdates
152- dispatch . bind ( null , topLevelType ) ,
154+ dispatch ,
153155 ) ;
154156}
155157
@@ -177,16 +179,15 @@ export function trapCapturedEvent(
177179 element ,
178180 getRawEventName ( topLevelType ) ,
179181 // Check if interactive and wrap in interactiveUpdates
180- dispatch . bind ( null , topLevelType ) ,
182+ dispatch ,
181183 ) ;
182184}
183185
184- function dispatchInteractiveEvent ( topLevelType , nativeEvent ) {
185- interactiveUpdates ( dispatchEvent , topLevelType , nativeEvent ) ;
186+ function dispatchInteractiveEvent ( nativeEvent ) {
187+ interactiveUpdates ( dispatchEvent , nativeEvent ) ;
186188}
187189
188190export function dispatchEvent (
189- topLevelType : DOMTopLevelEventType ,
190191 nativeEvent : AnyNativeEvent ,
191192) {
192193 if ( ! _enabled ) {
@@ -208,7 +209,6 @@ export function dispatchEvent(
208209 }
209210
210211 const bookKeeping = getTopLevelCallbackBookKeeping (
211- topLevelType ,
212212 nativeEvent ,
213213 targetInst ,
214214 ) ;
0 commit comments