@@ -75,48 +75,50 @@ export function NativeDetector({ gesture, children }: NativeDetectorProps) {
7575
7676 configureRelations ( gesture ) ;
7777
78- const handleGestureEvent = (
79- key : keyof GestureEvents < unknown > ,
80- e : GestureHandlerEvent < unknown >
81- ) => {
82- const handlerTag = getHandlerTag ( e ) ;
83- const method = ! logicMethods . current . has ( handlerTag )
84- ? gesture . gestureEvents [ key ]
85- : logicMethods . current . get ( handlerTag ) ?. current ?. [ key ] ;
86- invokeDetectorEvent ( method as ( e : GestureHandlerEvent < unknown > ) => void , e ) ;
78+ const handleGestureEvent = ( key : keyof GestureEvents < unknown > ) => {
79+ return ( e : GestureHandlerEvent < unknown > ) => {
80+ const handlerTag = getHandlerTag ( e ) ;
81+
82+ const method = ! logicMethods . current . has ( handlerTag )
83+ ? gesture . gestureEvents [ key ]
84+ : logicMethods . current . get ( handlerTag ) ?. current ?. [ key ] ;
85+
86+ invokeDetectorEvent (
87+ method as ( e : GestureHandlerEvent < unknown > ) => void ,
88+ e
89+ ) ;
90+ } ;
8791 } ;
8892
8993 return (
9094 < DetectorContext . Provider value = { { register, unregister } } >
9195 < NativeDetectorComponent
92- onGestureHandlerStateChange = { ( e ) => {
93- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
94- handleGestureEvent ( 'onGestureHandlerStateChange' , e ) ;
95- } }
96- onGestureHandlerEvent = { ( e ) => {
97- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
98- handleGestureEvent ( 'onGestureHandlerEvent' , e ) ;
99- } }
100- onGestureHandlerAnimatedEvent = { ( e ) => {
101- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
102- handleGestureEvent ( 'onGestureHandlerAnimatedEvent' , e ) ;
103- } }
104- onGestureHandlerTouchEvent = { ( e ) => {
105- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
106- handleGestureEvent ( 'onGestureHandlerTouchEvent' , e ) ;
107- } }
108- onGestureHandlerReanimatedStateChange = { ( e ) => {
109- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
110- handleGestureEvent ( 'onReanimatedStateChange' , e ) ;
111- } }
112- onGestureHandlerReanimatedEvent = { ( e ) => {
113- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
114- handleGestureEvent ( 'onReanimatedUpdateEvent' , e ) ;
115- } }
116- onGestureHandlerReanimatedTouchEvent = { ( e ) => {
117- // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
118- handleGestureEvent ( 'onReanimatedTouchEvent' , e ) ;
119- } }
96+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
97+ onGestureHandlerStateChange = { handleGestureEvent (
98+ 'onGestureHandlerStateChange'
99+ ) }
100+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
101+ onGestureHandlerEvent = { handleGestureEvent ( 'onGestureHandlerEvent' ) }
102+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
103+ onGestureHandlerAnimatedEvent = { handleGestureEvent (
104+ 'onGestureHandlerAnimatedEvent'
105+ ) }
106+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
107+ onGestureHandlerTouchEvent = { handleGestureEvent (
108+ 'onGestureHandlerTouchEvent'
109+ ) }
110+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
111+ onGestureHandlerReanimatedStateChange = { handleGestureEvent (
112+ 'onReanimatedStateChange'
113+ ) }
114+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
115+ onGestureHandlerReanimatedEvent = { handleGestureEvent (
116+ 'onReanimatedUpdateEvent'
117+ ) }
118+ // @ts -ignore This is a type mismatch between RNGH types and RN Codegen types
119+ onGestureHandlerReanimatedTouchEvent = { handleGestureEvent (
120+ 'onReanimatedTouchEvent'
121+ ) }
120122 moduleId = { globalThis . _RNGH_MODULE_ID }
121123 handlerTags = { isComposedGesture ( gesture ) ? gesture . tags : [ gesture . tag ] }
122124 style = { styles . detector }
0 commit comments