Skip to content

Commit

Permalink
Add missing type for AnimatedValue.resetAnimation() and AnimatedValue…
Browse files Browse the repository at this point in the history
….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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Dec 14, 2022
1 parent 64475ae commit 25a25ea
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Libraries/Animated/Animated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,28 @@ 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.
*/
interpolate<OutputT extends number | string>(
config: InterpolationConfigType,
): AnimatedInterpolation<OutputT>;

/**
* 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;
Expand All @@ -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;
Expand Down

0 comments on commit 25a25ea

Please sign in to comment.