Skip to main content
Version: 2.x

cancelAnimation

Cancels animation linked to given shared value.

Arguments

sharedValue [SharedValueRef]

The value for which we want the previously started animation to be cancelled. If there was no animation started on that value, or the animation completed, no error will be thrown.

Example

const someValue = useSharedValue(0);

const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
cancelAnimation(someValue);
},
});

We are Software Mansion.