From 1b5066c21dde90f31753d6d84bce3d8817071451 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 14 Dec 2022 10:51:00 -0800 Subject: [PATCH] Add missing type for AnimatedValue.resetAnimation() and AnimatedValue.animate() Summary: See https://www.internalfb.com/code/fbsource/[d96fd0b6ac13]/xplat/js/react-native-github/Libraries/Animated/nodes/AnimatedValue.js?lines=207 Changelog: [General][Fixed] - Add missing type for AnimatedValue.resetAnimation() and AnimatedValue.animate() Reviewed By: christophpurrer Differential Revision: D42034719 fbshipit-source-id: 40e25940e04bdf296c8b5e4bf39bee2e4baeae07 --- Libraries/Animated/Animated.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Libraries/Animated/Animated.d.ts b/Libraries/Animated/Animated.d.ts index 215f773cac2411..6054244af9d5f4 100644 --- a/Libraries/Animated/Animated.d.ts +++ b/Libraries/Animated/Animated.d.ts @@ -168,6 +168,13 @@ export namespace Animated { */ stopAnimation(callback?: (value: number) => void): void; + /** + * Stops any animation and resets the value to its original. + * + * See https://reactnative.dev/docs/animatedvalue#resetanimation + */ + resetAnimation(callback?: (value: number) => void): void; + /** * Interpolates the value before updating the property, e.g. mapping 0-1 to * 0-10. @@ -175,6 +182,14 @@ export namespace Animated { interpolate( config: InterpolationConfigType, ): AnimatedInterpolation; + + /** + * Typically only used internally, but could be used by a custom Animation + * class. + * + * See https://reactnative.dev/docs/animatedvalue#animate + */ + animate(animation: Animation, callback?: EndCallback | null): void; } type ValueXYListenerCallback = (value: {x: number; y: number}) => void; @@ -201,6 +216,8 @@ export namespace Animated { extractOffset(): void; + resetAnimation(callback?: (value: {x: number; y: number}) => void): void; + stopAnimation(callback?: (value: {x: number; y: number}) => void): void; addListener(callback: ValueXYListenerCallback): string;