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 Riccardo Cipolleschi committed Dec 19, 2022
1 parent 98ad399 commit 1b5066c
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 1b5066c

Please sign in to comment.