Skip to content

Commit ff64e3f

Browse files
authored
Fix onUpdate crash (#3636)
## Description #3630 introduced automatic support for `Animated.Event` in `onUpdate` callback. However, I've missed the fact that this callback may not be defined. This PR fixes this crash. ## Test plan Tested on current basic-example without specifying `onUpdate`
1 parent 2c24bd1 commit ff64e3f

File tree

1 file changed

+2
-2
lines changed
  • packages/react-native-gesture-handler/src/v3/hooks

1 file changed

+2
-2
lines changed

packages/react-native-gesture-handler/src/v3/hooks/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ export function isEventForHandlerWithTag(
8989
}
9090

9191
export function isAnimatedEvent(
92-
callback: ((event: any) => void) | AnimatedEvent
92+
callback: ((event: any) => void) | AnimatedEvent | undefined
9393
): callback is AnimatedEvent {
9494
'worklet';
9595

96-
return '_argMapping' in callback;
96+
return !!callback && '_argMapping' in callback;
9797
}
9898

9999
export function checkMappingForChangeProperties(obj: Animated.Mapping) {

0 commit comments

Comments
 (0)