Skip to main content
Version: 2.5.x

cancelAnimation

Cancels animation linked with 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);  },});