Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -21,8 +21,6 @@ export function resolveInternalConfigProps<
THandlerData,
TExtendedHandlerData extends THandlerData,
>(config: BaseGestureConfig<TConfig, THandlerData, TExtendedHandlerData>) {
const runOnJS = maybeUnpackValue(config.runOnJS);

if (
__DEV__ &&
isNativeAnimatedEvent(config.onUpdate) &&
Expand Down Expand Up @@ -63,8 +61,6 @@ export function resolveInternalConfigProps<
hasWorkletEventHandlers(config) &&
!config.dispatchesAnimatedEvents;
config.needsPointerData = shouldHandleTouchEvents(config);
config.dispatchesReanimatedEvents =
config.shouldUseReanimatedDetector && !runOnJS;
}

export function prepareConfigForNativeSide<
Expand All @@ -80,7 +76,10 @@ export function prepareConfigForNativeSide<
TConfig,
THandlerData,
TExtendedHandlerData
> = {};
> = {
dispatchesReanimatedEvents:
config.shouldUseReanimatedDetector && !maybeUnpackValue(config.runOnJS),
};
const handlerPropsWhiteList =
PropsWhiteLists.get(handlerType) ?? EMPTY_WHITE_LIST;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const allowedNativeProps = new Set<
'userSelect',
'enableContextMenu',
'touchAction',
'dispatchesReanimatedEvents',
'dispatchesAnimatedEvents',
'needsPointerData',
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@ export function bindSharedValues<
}

const baseListenerId = handlerTag + SHARED_VALUE_OFFSET;
const { shouldUseReanimatedDetector } = config;

const attachListener = (sharedValue: SharedValue, configKey: string) => {
'worklet';
const keyHash = hash(configKey);
const listenerId = baseListenerId + keyHash;

sharedValue.addListener(listenerId, (value) => {
if (configKey === 'runOnJS') {
config.dispatchesReanimatedEvents =
config.shouldUseReanimatedDetector && !value;

updateGestureHandlerConfig(handlerTag, {
dispatchesReanimatedEvents: config.dispatchesReanimatedEvents,
});
} else {
updateGestureHandlerConfig(handlerTag, { [configKey]: value });
}
updateGestureHandlerConfig(
handlerTag,
configKey === 'runOnJS'
? {
dispatchesReanimatedEvents: shouldUseReanimatedDetector && !value,
}
: { [configKey]: value }
);
});
};

Expand Down
Loading