Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ export function NativeDetector<THandlerData, TConfig>({
// @ts-ignore This is a type mismatch between RNGH types and RN Codegen types
onGestureHandlerEvent={handleGestureEvent('onGestureHandlerEvent')}
// @ts-ignore This is a type mismatch between RNGH types and RN Codegen types
onGestureHandlerAnimatedEvent={handleGestureEvent(
'onGestureHandlerAnimatedEvent'
)}
onGestureHandlerAnimatedEvent={
gesture.gestureEvents.onGestureHandlerAnimatedEvent
}
// @ts-ignore This is a type mismatch between RNGH types and RN Codegen types
onGestureHandlerTouchEvent={handleGestureEvent(
'onGestureHandlerTouchEvent'
Expand Down
10 changes: 8 additions & 2 deletions packages/react-native-gesture-handler/src/v3/hooks/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
SingleGestureName,
InternalConfigProps,
HandlersPropsWhiteList,
GestureCallbacks,
} from '../types';
import { GestureTouchEvent } from '../../handlers/gestureHandlerCommon';
import { tagMessage } from '../../utils';
Expand Down Expand Up @@ -110,8 +111,9 @@ const allowedNativeProps = new Set<
'changeEventCalculator',
]);

const PropsToFilter = new Set<BaseGestureConfig<unknown, unknown>>([
// Callbacks
export const HandlerCallbacks = new Set<
keyof Required<GestureCallbacks<unknown>>
>([
'onBegin',
'onStart',
'onUpdate',
Expand All @@ -121,6 +123,10 @@ const PropsToFilter = new Set<BaseGestureConfig<unknown, unknown>>([
'onTouchesMove',
'onTouchesUp',
'onTouchesCancelled',
]);

const PropsToFilter = new Set<BaseGestureConfig<unknown, unknown>>([
...HandlerCallbacks,

// Config props
'changeEventCalculator',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import RNGestureHandlerModule from '../../../RNGestureHandlerModule';
import { Reanimated } from '../../../handlers/gestures/reanimatedWrapper';
import { BaseGestureConfig, SharedValue } from '../../types';
import { HandlerCallbacks } from '../utils';

// Variant of djb2 hash function.
// Taken from https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765
Expand Down Expand Up @@ -77,7 +78,11 @@ export function unbindSharedValues<THandlerData, TConfig>(
export function hasWorkletEventHandlers<THandlerData, TConfig>(
config: BaseGestureConfig<THandlerData, TConfig>
) {
return Object.values(config).some(
(prop) => typeof prop === 'function' && '__workletHash' in prop
return Object.entries(config).some(
(key, value) =>
(key as keyof BaseGestureConfig<THandlerData, TConfig>) in
HandlerCallbacks &&
typeof value === 'function' &&
'__workletHash' in value
);
}
Loading