Skip to content

Commit

Permalink
Add AnimatedInterpolation as possible type for toValue (#27558)
Browse files Browse the repository at this point in the history
Summary:
AnimatedInterpolation should be a valid type to pass to `toValue` according to the documentation.

https://facebook.github.io/react-native/docs/animations#tracking-dynamic-values

## Changelog

[General] [Fixed] - Add AnimationInterpolation as possible type for toValue
Pull Request resolved: #27558

Test Plan: `yarn flow` works without errors.

Differential Revision: D19296804

Pulled By: cpojer

fbshipit-source-id: 7f09c762308c40f1eede5834fadf1837114aa397
  • Loading branch information
nabati authored and facebook-github-bot committed Jan 7, 2020
1 parent d126507 commit 26e8870
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Libraries/Animated/src/animations/SpringAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

const AnimatedValue = require('../nodes/AnimatedValue');
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
const Animation = require('./Animation');
const SpringConfig = require('../SpringConfig');

Expand All @@ -30,7 +31,8 @@ export type SpringAnimationConfig = AnimationConfig & {
y: number,
...
}
| AnimatedValueXY,
| AnimatedValueXY
| AnimatedInterpolation,
overshootClamping?: boolean,
restDisplacementThreshold?: number,
restSpeedThreshold?: number,
Expand All @@ -53,7 +55,7 @@ export type SpringAnimationConfig = AnimationConfig & {
};

export type SpringAnimationConfigSingle = AnimationConfig & {
toValue: number | AnimatedValue,
toValue: number | AnimatedValue | AnimatedInterpolation,
overshootClamping?: boolean,
restDisplacementThreshold?: number,
restSpeedThreshold?: number,
Expand Down
6 changes: 4 additions & 2 deletions Libraries/Animated/src/animations/TimingAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

const AnimatedValue = require('../nodes/AnimatedValue');
const AnimatedValueXY = require('../nodes/AnimatedValueXY');
const AnimatedInterpolation = require('../nodes/AnimatedInterpolation');
const Animation = require('./Animation');

const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
Expand All @@ -27,15 +28,16 @@ export type TimingAnimationConfig = AnimationConfig & {
y: number,
...
}
| AnimatedValueXY,
| AnimatedValueXY
| AnimatedInterpolation,
easing?: (value: number) => number,
duration?: number,
delay?: number,
...
};

export type TimingAnimationConfigSingle = AnimationConfig & {
toValue: number | AnimatedValue,
toValue: number | AnimatedValue | AnimatedInterpolation,
easing?: (value: number) => number,
duration?: number,
delay?: number,
Expand Down

0 comments on commit 26e8870

Please sign in to comment.